         // BUG: with different line break modes at range 0, the text manager seems to layout only the first line fragment
         // and then stop, investigate more, for now, force WordWrapping
         // paragraph.lineBreakMode = lineBreakMode
-        paragraph.lineBreakMode = .ByWordWrapping
+        paragraph.lineBreakMode = .byWordWrapping
         let attributes = [
             NSFontAttributeName: font,
             NSForegroundColorAttributeName: textColor,
             NSShadowAttributeName: shadow,
             NSParagraphStyleAttributeName: paragraph
-        ]
+        ] as [String : Any]
         var string = NSMutableAttributedString(string: text, attributes: attributes)
         // Copy existing attributes, we do it after because they may override the label default values
-        attributedText.enumerateAttributesInRange(NSRange(location: 0, length: attributedText.length), options: []) { (attrs, range, stop) in
+        attributedText.enumerateAttributes(in: NSRange(location: 0, length: attributedText.length), options: []) { (attrs, range, stop) in
             string.addAttributes(attrs, range: range)
             if range.location == 0 {
-                if var paragraph = attrs[NSParagraphStyleAttributeName] as? NSMutableParagraphStyle {
+                if let paragraph = attrs[NSParagraphStyleAttributeName] as? NSParagraphStyle {
+                    var newParagraph = paragraph.mutableCopy() as! NSMutableParagraphStyle
                     // Same as above
-                    paragraph.lineBreakMode = .ByWordWrapping
-                    string.addAttribute(NSParagraphStyleAttributeName, value: paragraph, range: range)
+                    newParagraph.lineBreakMode = .byWordWrapping
+                    string.addAttribute(NSParagraphStyleAttributeName, value: newParagraph, range: range)
                 }
             }
         }
         textStorage.setAttributedString(string)
         
-        let columnWidth = (frame.width - CGFloat(max(0, Int(numberOfColumns) - 1)) * columnsSpacing) / CGFloat(numberOfColumns)
+        let columnWidth = (frame.width - CGFloat(max(0, UInt(numberOfColumns - 1))) * columnsSpacing) / CGFloat(numberOfColumns)
         
         let singlecolumnContainer = singleColumnManager.textContainers[0] as NSTextContainer
-        singlecolumnContainer.size = CGSize(width: columnWidth, height: CGFloat.max)
-        singleColumnManager.glyphRangeForTextContainer(singlecolumnContainer)
+        singlecolumnContainer.size = CGSize(width: columnWidth, height: CGFloat.greatestFiniteMagnitude)
+        singleColumnManager.glyphRange(for: singlecolumnContainer)
 
         var columnHeight: CGFloat = 0.0
-        let proposedColumnHeight = ceil(singleColumnManager.usedRectForTextContainer(singlecolumnContainer).height / CGFloat(numberOfColumns))
-        singleColumnManager.enumerateLineFragmentsForGlyphRange(NSRange(location: 0, length: textStorage.length)) { (rect, usedRect, textContainer, glyphRange, stop) in
+        let proposedColumnHeight = ceil(singleColumnManager.usedRect(for: singlecolumnContainer).height / CGFloat(numberOfColumns))
+        singleColumnManager.enumerateLineFragments(forGlyphRange: NSRange(location: 0, length: textStorage.length)) { (rect, usedRect, textContainer, glyphRange, stop) in
             columnHeight += rect.height
             if columnHeight >= proposedColumnHeight {
-                stop.initialize(true)
+                stop.initialize(to: true)
             }
         }
 
         while multicolumnManager.textContainers.count != Int(numberOfColumns) {
             if multicolumnManager.textContainers.count < Int(numberOfColumns) {
-                let container = NSTextContainer(size: CGSize.zero)
+                let container = NSTextContainer(size: .zero)
                 container.lineFragmentPadding = 0.0
                 multicolumnManager.addTextContainer(container)
-                multicolumnManager.glyphRangeForTextContainer(container)
+                multicolumnManager.glyphRange(for: container)
             } else {
-                multicolumnManager.removeTextContainerAtIndex(multicolumnManager.textContainers.count - 1)
+                multicolumnManager.removeTextContainer(at: multicolumnManager.textContainers.count - 1)
             }
         }
      

        updateText()
    }
    
    override func intrinsicContentSize() -> CGSize {
        return sizeThatFits(CGSize(width: frame.width, height: CGFloat.max))
    }
    
    override func sizeThatFits(size: CGSize) -> CGSize {
        var height: CGFloat = 0.0
        for container in multicolumnManager.textContainers as [NSTextContainer] {
            height = max(height, multicolumnManager.usedRectForTextContainer(container).height)
        }
        return CGSize(width: size.width, height: height)
    }

    }
    
    private func commonInit() {
        let singlecolumnContainer = NSTextContainer(size: .zero)
        singlecolumnContainer.lineFragmentPadding = 0.0
        singleColumnManager.addTextContainer(singlecolumnContainer)
        
