Appearance Proxy in Swift (iOS)

ios, ios8, swift

Solution

This should do it:

segmentedControl.setTitleTextAttributes([
    NSFontAttributeName: UIFont(name: "Helvetica", size: 16.0)!,
    NSForegroundColorAttributeName: UIColor.blueColor()
    ], forState: UIControlState.Normal)

Problem

Has anyone tried using the appearance proxy in swift yet? This syntax doesn't work, has anyone figured out how to set title text attributes on controls like segmentedControl or UITabBar? I think I am close ``` segmentedControl.titleTextAttributesForState(UIControlState.Normal) = NSDictionary(objects: [UIFont(name: fontFamilyRegular, size: 16.0)], forKeys: [NSFontAttributeName]) ```

Original source