Fix. Remove duplications

This commit is contained in:
Igor Kislyuk 2017-04-26 11:46:38 +03:00
parent 00b7d11b37
commit 04a558b70f
3 changed files with 6 additions and 7 deletions

View File

@ -27,12 +27,7 @@ open class XibView: UIView {
/// Nib name used to instantiate inner view
open var innerViewNibName: String {
let clsName = String(describing: type(of: self))
if let typeRange = clsName.range(of: ".Type") {
return clsName.substring(to: typeRange.lowerBound)
} else {
return clsName
}
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

@ -35,3 +35,7 @@ public func className<T>(of type: T) -> String {
return clsName
}
}
public func typeName<T>(of type: T.Type) -> String {
return String(describing: type)
}