             UIContentSizeCategoryAccessibilityExtraExtraExtraLarge]
 
         var fonts: [String: UIFont?] = [:]
-        let middleIndex = floor(Double(fontSizes.count)/2.0)
+        let middleIndex = fontSizes.count/2
 
         for (index, fontSize) in enumerate(fontSizes) {
-            var size = Double(index)-middleIndex
+            var size = CGFloat(index-middleIndex)
             if size < 0 {
                 size *= decrement
             } else {

class PreferredFontManager: NSObject {
    private var fonts: [String: [String: UIFont?]] = [:]

    func registerFontsForTextStyle(style: String, fontName: String, baseFontSize: Double, increment: Double, decrement: Double, includeAccessibilitySizes: Bool = false) {
        let fontSizes = [UIContentSizeCategoryExtraSmall, UIContentSizeCategorySmall, UIContentSizeCategoryMedium,
            UIContentSizeCategoryLarge, UIContentSizeCategoryExtraLarge, UIContentSizeCategoryExtraExtraLarge,
            UIContentSizeCategoryExtraExtraExtraLarge]

            if includeAccessibilitySizes {
                offset = index
            }
            let size = CGFloat(offset+fontSizes.count-middleIndex)*increment+baseFontSize
            fonts[fontSize] = UIFont(name: fontName, size: CGFloat(size))
        }

