the missing support tool for building safe UIStoryboard code

Overview

seguecode

Travis Build Status

seguecode is a support tool to use alongside UIStoryboard development. It provides compile-time safeties around building with UIStoryboards in an effort to create an error free workflow so you can focus on the important things.

This include exposing:

  • Storyboard Scene Identifiers
  • Segue Identifiers
  • Table View Cell Prototype Identifiers
  • Collection View Cell Prototype Identifiers

Xcode Plugin

Installation

Alcatraz

AT THE MOMENT ALCATRAZ INSTALLATION IS BROKEN DUE TO ALCATRAZ'S METHOD OF BUILDING AND INSTALLING. UNTIL A COMPATIBLE WRAPPER PROJECT CAN BE REWRITTEN PLEASE USE THE MANUAL INSTALLATION STEPS BELOW.

The easiest way to get and use seguecode is through the wonderful Xcode plugin manager Alcatraz. The seguecode plugin, when enabled for a storyboard, will detect when you save your storyboard and automatically regenerate your seguecode source code.

Manually

  1. Clone the repo
  2. Run git submodule init ; git submodule update
  3. Run pod install
  4. Open seguecode.xcworkspace and build the seguecodePlugin scheme
  5. Close and reopen Xcode

Usage

To enable the seguecode plugin for a storyboard:

  1. Open the storyboard in Xcode
  2. Pull down Xcode's Edit menu and select the seguecode option

Plugin Screenshot

This will generate a file alongside your storyboard called <Storyboard Name>.seguecode.json which contains configuration information you can change to define how the automatic regeneration works.

The seguecode plugin looks for this json file to see if it should be enabled for a particular storyboard file, deleting it, or unchecking the seguecode option in the Edit menu, will disable the automatic regeneration.

Command Line

You can download the latest release

or

You can make your own build:

  1. Clone the repo
  2. Install the appropriate cocoapods with pod install
  3. Build the binary
  4. Place it in your favorite location for easy access.

It is recommended that you include a run of seguecode in your project as a Run Script Build Phase or as an External Build Target.

Exporting

For an accurate list of parameters run seguecode --help or seguecode -h

The most common usage is

seguecode -o OutputFolder/ ExportMe.storyboard

The resulting header and source files will be exported with the same name as your storyboard file. To use them they should be included in your project and your target.

Note: at minimum seguecode expects an output location and at least one storyboard file

Exporting Customization

To further customize your export use the following parameters:

  • -c or --combine - Export the View Controllers combined in one file
  • -p or --projectName NAME - Name to use as project in source file header comment
  • -l or --verbose - Output verbose logging
  • -v or --version - Display seguecode's version
  • -h or --help - Display help

Preparing your Storyboard

To ensure a proper export please make sure:

  • the segue you wish to use has an Identifier

For extra clarity and reduced conflicts please make sure:

  • the source and destination view controllers have Storyboard IDs

Results

Storyboard Identifier

TODO

Segue Identifier

Your exported header and source files will contain categories with selectors that describe your segue as well as optionally constants that can be used in your view controller ala self.performSegueWithIdentifier(..., sender: ...) call.

The resulting selectors and constants will depend on the segue Identifier and Storyboard IDs you used in your UIStoryboard.

For example, if you give your segue the Identifier MyHead, the source view controller's Storyboard ID Down and the destination view controller's MyToes the results will be:

Easy method calls:

extension MyViewController {
    @IBAction func performDownFromMyHead(sender : AnyObject? = nil)
}    

Easy constants:

extension MyViewController {
    struct Segues {
        static let DownFromMyHead
    }
}

To use the constant directly from your view controller call:

    self.performSegue(MyViewController.Segues.DownFromMyHead, sender: sender)

Table View Cell Prototype Identifiers

TODO

Collection View Cell Prototype Identifiers

TODO

Contributing

seguecode is a new project that will hopefully continue to grow in usefulness. If you have any ideas or suggestions on how it can better serve you please create an issue labeled feature (check to see if the issue exists first please!). Or suggest a pull request!

Thanks

Props to mogenerator for pointing out ddcli. And being a CoreData savior. And the kick in the butt to start seguecode.

Comments
  • cant create binary

    cant create binary

    How do you create the seguecode binary ?

    I tried installing the plugin from alcatraz, and from source code, building the project seguecodePlugin scheme does not create the binary, and building seguecode scheme gives too many errors on my computer. Can you simply upload a binary i can use ?

    opened by pikaboo 6
  • same name for a SegueID or TableCellPrototypeID in two different instances should be handled safely

    same name for a SegueID or TableCellPrototypeID in two different instances should be handled safely

    will cause both to export with the same name and cause compilation error should just export one, perhaps include annotation comments saying that it came from both

    enhancement 
    opened by yoiang 1
  • I finally got it to work and was so disappointed with the result

    I finally got it to work and was so disappointed with the result

    Hi,

    After lots of messing around I finally got seguecode to work with a runscript build phase however, I was very disappointed with the result.

    My entire project is written in objectiveC and I do not want to start switching to swift right now The result came in swift, when i expected it to be in objectiveC can you add a flag or something to get the result in objectiveC ?

    your entire help file shows that the generated code is in objective c

    and i did not want nor expect it to be in swift :(

    opened by pikaboo 1
  • how to create a build phase

    how to create a build phase

    I wrote this build phase in my project

    echo $(${SRCROOT}/../devtools/seguecode.bundle/Contents/MacOS/seguecode -v)

    yet it still tells me that it cant find seguecode

    opened by pikaboo 0
  • Plugin running should be for specified storyboard files

    Plugin running should be for specified storyboard files

    Currently runs on any storyboard file, should have a way to say "run on this one".

    Perhaps option to create config on current file, only run if saved storyboard has config.

    enhancement 
    opened by yoiang 0
  • waffle.io Badge

    waffle.io Badge

    Merge this to receive a badge indicating the number of issues in the ready column on your waffle.io board at https://waffle.io/Adorkable/seguecode

    This was requested by a real person (user yoiang) on waffle.io, we're not trying to spam you.

    opened by waffle-iron 0
  • Same View Controller used twice in a Storyboard with the same identifiers will cause identifiers to be exported twice and result in non-compiling code

    Same View Controller used twice in a Storyboard with the same identifiers will cause identifiers to be exported twice and result in non-compiling code

    should recognize the duplicate names and only export once, completely safe since they aren't specifically tied to instances yet

    perhaps include annotation comments saying that it came from both

    bug 
    opened by yoiang 0
  • README should include how Plugin Json works and how to configure it

    README should include how Plugin Json works and how to configure it

    i dont know how we can use it

    i have genrated .json file but how it will automatically called and how configuration is actually works

    Also how to integrate with Build phrase using runscript

    enhancement 
    opened by hardikdevios 1
Releases(2.3.1)
Owner
Adorkable
Adorkable
Adorkable
๐Ÿš€ Create XCFrameworks with ease! A Command Line Tool to create XCFramework for multiple platforms at one shot! The better way to deal with XCFrameworks for iOS, Mac Catalyst, tvOS, macOS, and watchOS.

Surmagic ?? Create XCFramework with ease! A Command Line Tool to create XCFramework for multiple platforms at one shot! The better way to deal with XC

Muhammed Gurhan Yerlikaya 260 Dec 28, 2022
Makes it easier to support older versions of iOS by fixing things and adding missing methods

PSTModernizer PSTModernizer carefully applies patches to UIKit and related Apple frameworks to fix known radars with the least impact. The current set

PSPDFKit Labs 217 Aug 9, 2022
A tool for finding missing and unused NSLocalizedStrings

nslocalizer This is a command line tool that is used for discovering missing and unused localization strings in Xcode projects. Contributing and Code

Samantha Demi 155 Sep 17, 2022
SwiftGen is a tool to automatically generate Swift code for resources of your projects (like images, localised strings, etc), to make them type-safe to use.

SwiftGen is a tool to automatically generate Swift code for resources of your projects (like images, localised strings, etc), to make them type-safe to use.

null 8.3k Jan 5, 2023
DevTool - A simple UI and powerful Mac OS application, Such as JSON-Formatting tool, JSON-to-model tool, AppIcon generator, Network-Request tool...

?? ?? ?? A simple UI and powerful Mac OS application. It is a collection of tools commonly used in my development work. Such as JSON-Formatting tool, JSON-to-model tool, AppIcon generator, Network-Request tool...

ๆธ ๆ™“ๅ‹ 3 Dec 21, 2022
Stagehand provides a modern, type-safe API for building animations on iOS

Stagehand Stagehand provides a modern, type-safe API for building animations on iOS. Stagehand is designed around a set of core ideas: Composition of

Cash App 118 Dec 3, 2022
Dynamic and type-safe framework for building linear and non-linear flows.

FlowKit FlowKit is a dynamic flow framework capable of building a flow, based on conditions and ordered according to a logic of next steps. By using F

N26 55 Dec 20, 2022
A place to share code and server configurations in support of the networkQuality tool

Network Quality Server Welcome! The Network Quality Server project was created as a place to share example servers that can used by the networkQuality

null 99 Jan 3, 2023
MemoryCache - type-safe, thread-safe memory cache class in Swift

MemoryCache is a memory cache class in swift. The MemoryCache class incorporates LRU policies, which ensure that a cache doesnโ€™t

Yusuke Morishita 74 Nov 24, 2022
Modern thread-safe and type-safe key-value observing for Swift and Objective-C

Now Archived and Forked PMKVObserver will not be maintained in this repository going forward. Please use, create issues on, and make PRs to the fork o

Postmates Inc. 708 Jun 29, 2022
A Protocol-Oriented NotificationCenter which is type safe, thread safe and with memory safety

A Protocol-Oriented NotificationCenter which is type safe, thread safe and with memory safety. Type Safe No more userInfo dictionary and Downcasting,

null 632 Dec 7, 2022
A library for building an internal/development support app easily

Scenarios A library supporting fast prototyping for iOS Projects. Introduction Challenges of mobile frontend development Stories with multiple require

An Tran 29 Sep 15, 2022
UIDevice extensions that fill in the missing pieces.

UIDeviceComplete is an iOS library intended to be a collection of extensions to UIDevice that provides functionality that UIDevice currently lacks like determining which iOS device you have (i.e iPhone X, iPhone 8, iPhone SE, iPad Pro, iPhone 7 etc) or determining the screen size of the device in inches.

Nicholas Maccharoli 408 Dec 11, 2022
RadioGroup - The missing iOS radio buttons group.

RadioGroup The missing iOS radio buttons group. Usage let radioGroup = RadioGroup(titles: ["First Option Title", "Another Option Title", "Last"]) radi

Yonat Sharon 188 Dec 20, 2022
๐ŸŽ› QGrid: The missing SwiftUI collection view.

[NOTE] If you'd like to see QGrid in action, check out this demo of QDesigner (see video below). Install QDesigner: https://apps.apple.com/us/app/qdes

Q Mobile 1.5k Dec 23, 2022
The ISO 8601 period/duration types missing in Foundation

PeriodDuration This library introduces a close equivalent to Java's PeriodDuration, motivated by the lack of support for this standard in Foundation.

David Roman 19 Jun 22, 2022
UIDevice extensions that fill in the missing pieces.

UIDeviceComplete UIDevice extensions that fill in the missing pieces. Whats this library about? UIDeviceComplete is an iOS library intended to be a co

Nicholas Maccharoli 408 Dec 11, 2022
The missing Apple Weather App for Mac.

BetterWeather The missing Weather App for your Mac and iPad. Installation for mac. Download the notarized, universal binary from here Click the curren

Aayush 21 Jul 31, 2022
The missing light persistence layer for Swift

If you're planning on using Swift 4 in the near future, please consider using the new Codable protocols which provide the same functionality as Pantry

Nick O'Neill 842 Sep 11, 2022
A collection of missing SwiftUI components

SwiftUIKit A collection of components that will simplify and accelerate your iOS development. Components CurrencyTextField AdaptToKeyboard (not needed

youjinp 239 Nov 18, 2022