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

OSX issue #35

Closed krzyzanowskim closed 7 years ago

krzyzanowskim commented 9 years ago

this https://github.com/krzyzanowskim/Natalie/blame/master/natalie.swift#L681 is not working for OSX. Do not compile. saying that Segue is not convertible to AnyObject.Type cc @phimage

krzyzanowskim commented 9 years ago

it's here where the problem is visible: https://github.com/krzyzanowskim/Natalie/blame/master/natalie.swift#L958 cc @jai

phimage commented 9 years ago

the generated code doesn't compile?

In my project I have this generated code and its work (Xcode 6.3.2 and 10.10 OSX target) (not generated since all PR merge from today)

extension MyViewController {

    enum Segue: String, Printable, SegueProtocol {
        case add = "add"
        case activate = "activate"

        var kind: SegueKind? {
            switch (self) {
            case add:
                return SegueKind(rawValue: "sheet")
            case activate:
                return SegueKind(rawValue: "sheet")
            default:
                preconditionFailure("Invalid value")
                break
            }
        }

        var destination: AnyObject.Type? {
            switch (self) {
            case add:
                return InputController.self
            default:
                assertionFailure("Unknown destination")
                return nil
            }
        }

        var identifier: String? { return self.description }
        var description: String { return self.rawValue }
    }

}
krzyzanowskim commented 9 years ago

screen shot 2015-05-27 at 15 59 06

krzyzanowskim commented 9 years ago

ha! damn. it's the Swift thing. I named segue after view controller type. It seem the issue like found here: https://github.com/krzyzanowskim/Natalie/pull/32

phimage commented 9 years ago

segue have bad names, same as controller class There is no naming convention but something like ShowXxx, ToXxx or action name is better

krzyzanowskim commented 9 years ago

It should be possible to have it working this way. It would require have Storyboards.swift as a separate module.

CallumOz commented 9 years ago

What is the support for Swift frameworks on OS X ? They are only supported on iOS 8.

Just something to think about.

phimage commented 9 years ago

@CallumOz frameworks or storyboards ? Swift is available for OS X 10.9+ and storyboards for OS X 10.10+

CallumOz commented 9 years ago

I thought that to have a custom module, you needed to use a pure swift Framework. Pure swift Frameworks, from my quick google search, seem to only be supported on 10.10