https://github.com/vadymmarkov/typehelper
A simple function for getting the name of the non optional type in Swift.
https://github.com/vadymmarkov/typehelper
Last synced: 7 months ago
JSON representation
A simple function for getting the name of the non optional type in Swift.
- Host: GitHub
- URL: https://github.com/vadymmarkov/typehelper
- Owner: vadymmarkov
- License: other
- Created: 2015-03-26T20:42:46.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-02-26T15:57:03.000Z (over 9 years ago)
- Last Synced: 2025-03-06T15:52:10.002Z (7 months ago)
- Language: Swift
- Size: 10.7 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# TypeHelper
[](http://cocoadocs.org/docsets/TypeHelper)
[](http://cocoadocs.org/docsets/TypeHelper)
[](http://cocoadocs.org/docsets/TypeHelper)A simple function for getting the name of the non optional type in Swift (from optional or implicitly unwrapped optional types).
## Usage
```swift
let some: SomeClass = SomeClass()
let someOptional: SomeClass? = SomeClass()
let someImplicitlyUnwrappedOptional: SomeClass! = SomeClass()println(nonOptionalTypeName(some.dynamicType)) // .SomeClass
println(nonOptionalTypeName(someOptional.dynamicType)) // .SomeClass
println(nonOptionalTypeName(someImplicitlyUnwrappedOptional.dynamicType)) // .SomeClassprintln(nonOptionalTypeName(Printable)) // Swift.Printable
println(nonOptionalTypeName(Printable?)) // Swift.Printableprintln(nonOptionalTypeName(UIView)) // UIView
println(nonOptionalTypeName(UIView?)) // UIView```
## Installation
**TypeHelper** is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:```ruby
pod 'TypeHelper'
```## Author
Vadym Markov, impressionwave@gmail.com
## License
**TypeHelper** is available under the MIT license. See the LICENSE file for more info.