krzyzanowskim / Natalie

Natalie - Storyboard Code Generator (for Swift)
http://blog.krzyzanowskim.com/2015/04/15/natalie-storyboard-code-generator/
MIT License
1.17k stars 74 forks source link

Generate ids for localizable strings and images #50

Open Shulepov opened 9 years ago

Shulepov commented 9 years ago

I'm not sure that this functionality should be placed directly inside Natalie, may be should be created a different tool.

Generating identifiers for storyboards stuff definitely is a good step :) But there are also quite a lot of magic strings in the project - for localizable strings (NSLocalizedString("Hello", ...)) or for images UIImage(named: "Logo"), and other files in the bundle.

So, may be also can be generated analogue of R file on android. So, for strings and images can be generated something like:

struct Strings {
     static let Hello = "Hello"
}
struct Images {
    static let Logo = "Logo"
}

And for convenience:

struct LocalizedString {
     static var Hello = { return NSLocalizedString(Strings.hello, ...) }
}
CallumOz commented 9 years ago

Apple did a great talk on this at WWDC 2015 called Swift in practise.

krzyzanowskim commented 9 years ago

Thanks, this is valid feature request, I'd like to have it. I'll work on that after transition to Swift 2.0

krzyzanowskim commented 9 years ago

@CallumOz As seen on tv ;-)

a1cooke commented 7 years ago

@krzyzanowskim was thinking of starting to look at help out on some of this, looking at the binary invocation, do you have thoughts on what it might look like in terms of invoking the API

krzyzanowskim commented 7 years ago

hey, great! I don't have any preferences in that regard. Feel free to propose something. I'm looking forward to merge it!