el.severo
el.severo

Reputation: 2277

swift 2.0 convert UIFontDescriptorSymbolicTraits to CTFontSymbolicTraits

How I can convert a UIFontDescriptorSymbolicTraits to CTFontSymbolicTraits ?

Upvotes: 0

Views: 271

Answers (1)

matt
matt

Reputation: 534925

Look at how they are defined. Here is CTFontSymbolicTraits:

enum {
kCTFontItalicTrait = (1 << 0),
kCTFontBoldTrait = (1 << 1),
kCTFontExpandedTrait = (1 << 5),
kCTFontCondensedTrait = (1 << 6),
// ...
};
typedef uint32_t CTFontSymbolicTraits;

Here is UIFontDescriptorSymbolicTraits:

typedef enum : uint32_t {
   UIFontDescriptorTraitItalic = 1u << 0,
   UIFontDescriptorTraitBold = 1u << 1,
   UIFontDescriptorTraitExpanded = 1u << 5,
   UIFontDescriptorTraitCondensed = 1u << 6,
   // ...
} UIFontDescriptorSymbolicTraits;

Notice anything? As far as the traits that matter to you are concerned, they are in fact identical. There is nothing to convert.

Upvotes: 1

Related Questions