Fix building for iOS

This commit is contained in:
Nate Weaver 2020-04-30 11:50:53 -05:00
parent f38406e3ac
commit cce4b56ee5
1 changed files with 8 additions and 4 deletions

View File

@ -65,7 +65,7 @@ extension NSAttributedString {
#if canImport(AppKit) #if canImport(AppKit)
descriptor = descriptor.withSymbolicTraits(newSymbolicTraits) descriptor = descriptor.withSymbolicTraits(newSymbolicTraits)
#else #else
var descriptor = descriptor.withSymbolicTraits(newSymbolicTraits)! descriptor = descriptor.withSymbolicTraits(newSymbolicTraits)!
#endif #endif
if symbolicTraits.contains(boldTrait) { if symbolicTraits.contains(boldTrait) {
@ -230,18 +230,22 @@ extension NSAttributedString {
var symbolicTraits = currentDescriptor.symbolicTraits var symbolicTraits = currentDescriptor.symbolicTraits
if styles.contains(.bold) { if styles.contains(.bold) {
symbolicTraits.insert(.bold) symbolicTraits.insert(boldTrait)
} }
if styles.contains(.italic) { if styles.contains(.italic) {
symbolicTraits.insert(.italic) symbolicTraits.insert(italicTrait)
} }
if styles.contains(.monospace) { if styles.contains(.monospace) {
symbolicTraits.insert(.monoSpace) symbolicTraits.insert(monoSpaceTrait)
} }
#if canImport(AppKit)
descriptor = descriptor.withSymbolicTraits(symbolicTraits) descriptor = descriptor.withSymbolicTraits(symbolicTraits)
#else
descriptor = descriptor.withSymbolicTraits(symbolicTraits)!
#endif
func verticalPositionFeature(forSuperscript: Bool) -> [FontDescriptor.FeatureKey: Any] { func verticalPositionFeature(forSuperscript: Bool) -> [FontDescriptor.FeatureKey: Any] {
#if canImport(AppKit) #if canImport(AppKit)