-
Notifications
You must be signed in to change notification settings - Fork 38
[Storyboards] Change .controller
to .instantiate()
#65
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works in 2 tested codebases.
Todo: update the code samples in templates docs, main repo readme, and playground.
The GoT episode was on fire!
@djbe thought: provide an additional template with @available(*, deprecated, rename: "initialScene.instantiate()")
static func instantiateInitialScene() -> {{sceneClass}} { return initialScene.instantiate() } 📑 Compatibility template example (proof of concept) — open to see code
Not tested, but I guess you see the idea. Worth it? (or maybe not as a bundle template, but just paste it somewhere in the wiki or MG and let people copy it manually if they need, to make it less official?) |
💡 This made me realise that we didn't document the |
Hmmm, I wouldn't add as an alternative template, that's more code we have to maintain. Maybe put it in a wiki page, and point the MG to it. Mention on that wiki page that it won't be maintained. It is a small change after all. |
It is documented in the templates docs. |
Oh, you mean the template inferring the modules, gotcha. |
I mean that https://github.com/SwiftGen/templates/blob/master/Documentation/storyboards/swift3.md mentions |
Yeah, hence the idea of just pasting it in a wiki page, not bundling it in SwiftGen. And mentioning it as something like:
Sure but it could be very tedious to have to rename every single call to a StoryboardScene in an existing huge codebase… one by one… by hand. While [UPDATE]: Here it is, added in the wiki |
That should be the changes for this PR/repo. @AliSoftware you might want to proofread the changelog entry, and then it should be GTM. |
@djbe as discussed in Slack earlier today. I'll let you run that template on the codebase you tested earlier to see if it's better. Will add CHANGELOG and MG entries later (after GoT 📺⚔️ 😄)
Note that this is a breaking change from 2.0 but given that 2.0 is used by nobody yet (as templates 2.0 requires SwiftGen 5.0 which isn't released yet) we'll probably just tag a 2.0.1. It's not really semver-correct but given 2.0 isn't really officially out and was useless without SwiftGen 5 I feel that it's ok.
TODO:
instantiateFoo
toFoo.instantiate
+ the compatibility helper templateparam.module
in the storyboard templates documentation (could be done in a separate PR as it's unrelated — it just happens that I just realised when re-reading those docs that we missed it, not sure it's worth its own PR though)