carlj / CJAMacros

Macro collection for daily usage
MIT License
97 stars 23 forks source link

[FR] Swift version #13

Open yurikoles opened 10 years ago

yurikoles commented 10 years ago

I think it may be implemented by avoiding use of macro, like some utility class and with class methods. And then used in Swift with it's own syntax, Xcode automatically converts API from Objective-C to Swift.

yurikoles commented 10 years ago

It's as easy as

if CJAUtility.deviceIsiPhone5() {
    println("The current device is an iPhone 5 or iPod Touch 5 Gen.")
}

chekout this SwiftDemoViewController.swift

carlj commented 10 years ago

as far as i understand this right now, swift doenst support any macros. So as you pointed out right we should ad a wrapper class that can be used directly within swift source code.

Thank you @yurikoles good point