Merge pull request #60 from TouchInstinct/bugfix/classname

Bugfix/classname
This commit is contained in:
Nikolai Ashanin 2017-04-26 16:55:33 +03:00 committed by GitHub
commit cb07c482d1
4 changed files with 14 additions and 6 deletions

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "LeadKit"
s.version = "0.4.8"
s.version = "0.4.9"
s.summary = "iOS framework with a bunch of tools for rapid development"
s.homepage = "https://github.com/TouchInstinct/LeadKit"
s.license = "Apache License, Version 2.0"

View File

@ -27,7 +27,7 @@ open class XibView: UIView {
/// Nib name used to instantiate inner view
open var innerViewNibName: String {
return className(of: type(of: self))
return className(of: self)
}
public convenience init() {

View File

@ -30,7 +30,7 @@ extension UIViewController {
- returns: type name string
*/
open class var xibName: String {
return className(of: self)
return typeName(of: self)
}
}

View File

@ -22,10 +22,10 @@
import Foundation
/// Function which returns string representation of type without ".Type" suffix
/// Function which returns string representation of object type
///
/// - Parameter type: a type
/// - Returns: string representation of type without ".Type" suffix
/// - Parameter type: an object type
/// - Returns: string representation of object type
public func className<T>(of type: T) -> String {
let clsName = String(describing: type(of: type))
@ -35,3 +35,11 @@ public func className<T>(of type: T) -> String {
return clsName
}
}
/// Function which returns string representation of class type
///
/// - Parameter type: an class type
/// - Returns: string representation of class type
public func typeName<T>(of type: T.Type) -> String {
return String(describing: type)
}