TestsTested | ✓ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Mar 2015 |
SPMSupports SPM | ✗ |
Maintained by Vadym Markov.
A simple function for getting the name of the non optional type in Swift (from optional or implicitly unwrapped optional types).
let some: SomeClass = SomeClass()
let someOptional: SomeClass? = SomeClass()
let someImplicitlyUnwrappedOptional: SomeClass! = SomeClass()
println(nonOptionalTypeName(some.dynamicType)) // <namespace>.SomeClass
println(nonOptionalTypeName(someOptional.dynamicType)) // <namespace>.SomeClass
println(nonOptionalTypeName(someImplicitlyUnwrappedOptional.dynamicType)) // <namespace>.SomeClass
println(nonOptionalTypeName(Printable)) // Swift.Printable
println(nonOptionalTypeName(Printable?)) // Swift.Printable
println(nonOptionalTypeName(UIView)) // UIView
println(nonOptionalTypeName(UIView?)) // UIView
TypeHelper is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'TypeHelper'
Vadym Markov, [email protected]
TypeHelper is available under the MIT license. See the LICENSE file for more info.