Skip to content
This repository has been archived by the owner on Jun 6, 2022. It is now read-only.

Make code generation extensible (see Paw extensions) #16

Open
brennanMKE opened this issue May 20, 2015 · 10 comments
Open

Make code generation extensible (see Paw extensions) #16

brennanMKE opened this issue May 20, 2015 · 10 comments

Comments

@brennanMKE
Copy link

Paw is a great REST client which has support for extensions for dynamic values and code generation. It is very powerful and customizable. This tool could make extensions an option by passing the graph of resources extracted from a storyboard to an extension script which can be used to generate output for any purpose. This way Objective-C, Swift and even Xamarin/C# could be supported.

You can see the Paw extensions at the link below.

https://luckymarmot.com/paw/extensions/?utm_campaign=find_extensions_2.2.1&utm_medium=app&utm_content=extensions_menu&utm_source=paw_http_client_app

These extensions are written with JavaScript to make it easier for more people to contribute. Fortunately node is included with Xcode.

find /Applications/Xcode.app/ -name node

/Applications/Xcode.app//Contents/Developer/usr/share/xcs/Node/bin/node --version

It is not a terribly current version of Node but it is a decent version. It may be possible to use the following command to select and run a version of Node whether or not the user has it installed already.

xcrun node --version

@yoiang
Copy link
Member

yoiang commented Jun 16, 2015

@brennanMKE I getcha! There is a framework already for template file support but it's pretty crude, I wouldn't recommend using it 👎

I've been debating whether to further develop this enhancement (and your other excellent suggestions) in the current version of seguecode or to make it an important part of the next version of seguecode which is currently (slowly) being written in Swift and will provide both Objective-C and Swift export code.

@brennanMKE
Copy link
Author

A framework which simply can read a storyboard file and provide a graph to navigate could be useful for this plugin and others. The only real trick is to connect all of the elements using the ID attributes. I'm interested in using it for all kinds of purposes, possibly even replicating table cells to other tables automatically or setting up a scene as a color swatch which defines a set of constants for the colors.

@yoiang
Copy link
Member

yoiang commented Jun 24, 2015

Funny you should say! I've just pushed up the framework the next version of seguecode will use for parsing: Adorkable/StoryboardKit

@brennanMKE
Copy link
Author

👍

@brennanMKE
Copy link
Author

An idea I came up with today was a color swatch feature which would use a file in the root of a project to define a set of colors. It could be used to add a "Color Swatch" scene to a configured Storyboard as well as generate a ColorSwatch class which has constants for those colors. I find I often have to mess around with colors a lot and having a color swatch on the Storyboard and in code could make this work much simpler. I think I'd simply generate a collection view with a cell for each color with the label set in the configuration file. I suppose I could inject and update a scene in the Storyboard easy enough.

@yoiang
Copy link
Member

yoiang commented Jun 24, 2015

I love it! I know exactly what you mean, Apple leaves a lot to be desired when it comes to reusing visual properties in IB and using libraries means code only support. I understand now how deep you mean when you say code generation extension, this would be a perfect example.

@brennanMKE
Copy link
Author

I'd also like to define a master scene for a table view which has all of the cell templates and then have them automatically replicated to other table views in other scenes. If I can copy table cell templates to other table views it would be helpful. I typically do not set outlets with cells anymore. I instead set tags on the views and use viewWithTag to assign them to an variable when the cell is being configured.

I would like it if we could reuse cell templates or actually any cell in other scenes like smart objects in PhotoShop. Any changes to one of them changes all of them immediately.

@yoiang
Copy link
Member

yoiang commented Aug 24, 2015

Hey @brennanMKE , the latest version of seguecode is out with Swift exports! Next step is to do basic custom template support but while working on that I'm going to think about extension integration!

@brennanMKE
Copy link
Author

@yoiang Excellent! Let me know if you'd like any help with it.

@yoiang
Copy link
Member

yoiang commented Aug 25, 2015

@brennanMKE I'll definitely let you know! I appreciate it :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants