Commit 932fc9c6 by adamdahan

Fix crash in fonts

parent e2d53c9e
...@@ -11,17 +11,26 @@ import UIKit ...@@ -11,17 +11,26 @@ import UIKit
public struct Roboto { public struct Roboto {
public static func lightWithSize(size: CGFloat) -> UIFont { public static func lightWithSize(size: CGFloat) -> UIFont {
return UIFont(name: "Roboto-Light", size: size)! if let light = UIFont(name: "Roboto-Light", size: size) {
return light
} else {
return UIFont.systemFontOfSize(size)
}
} }
public static func mediumWithSize(size: CGFloat) -> UIFont { public static func mediumWithSize(size: CGFloat) -> UIFont {
return UIFont(name: "Roboto-Medium", size: size)! if let light = UIFont(name: "Roboto-Medium", size: size) {
return light
} else {
return UIFont.systemFontOfSize(size)
}
} }
public static func regularWithSize(size: CGFloat) -> UIFont { public static func regularWithSize(size: CGFloat) -> UIFont {
var fonts = UIFont.fontNamesForFamilyName("Roboto") if let light = UIFont(name: "Roboto-Regular", size: size) {
println(fonts) return light
} else {
return UIFont(name: "Arial", size: size)! return UIFont.systemFontOfSize(size)
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment