Skip to content

Commit

Permalink
Update indentation for conditional code
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanhuang13 committed Jun 5, 2022
1 parent 965caa7 commit 873f3e3
Showing 1 changed file with 29 additions and 30 deletions.
59 changes: 29 additions & 30 deletions Sources/NSAttributedStringBuilder/Components/Component.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#if canImport(UIKit)
import UIKit
public typealias Size = CGSize
import UIKit
public typealias Size = CGSize
#elseif canImport(AppKit)
import AppKit
public typealias Size = NSSize
import AppKit
public typealias Size = NSSize
#endif

public protocol Component {
Expand All @@ -17,7 +17,7 @@ public enum Ligature: Int {
case `default` = 1

#if canImport(AppKit)
case all = 2 // Value 2 is unsupported on iOS
case all = 2 // Value 2 is unsupported on iOS
#endif
}

Expand Down Expand Up @@ -122,9 +122,9 @@ public extension Component {
}

#if canImport(AppKit)
func vertical() -> Component {
attributes([.verticalGlyphForm: 1])
}
func vertical() -> Component {
attributes([.verticalGlyphForm: 1])
}
#endif
}

Expand All @@ -143,8 +143,7 @@ public extension Component {
if let mps = attributes[.paragraphStyle] as? NSMutableParagraphStyle {
return mps
} else if let ps = attributes[.paragraphStyle] as? NSParagraphStyle,
let mps = ps.mutableCopy() as? NSMutableParagraphStyle
{
let mps = ps.mutableCopy() as? NSMutableParagraphStyle {
return mps
} else {
return NSMutableParagraphStyle()
Expand Down Expand Up @@ -229,29 +228,29 @@ public extension Component {
}

#if canImport(AppKit) && !targetEnvironment(macCatalyst)
func textBlocks(_ textBlocks: [NSTextBlock]) -> Component {
let paragraphStyle = getMutableParagraphStyle()
paragraphStyle.textBlocks = textBlocks
return self.paragraphStyle(paragraphStyle)
}
func textBlocks(_ textBlocks: [NSTextBlock]) -> Component {
let paragraphStyle = getMutableParagraphStyle()
paragraphStyle.textBlocks = textBlocks
return self.paragraphStyle(paragraphStyle)
}

func textLists(_ textLists: [NSTextList]) -> Component {
let paragraphStyle = getMutableParagraphStyle()
paragraphStyle.textLists = textLists
return self.paragraphStyle(paragraphStyle)
}
func textLists(_ textLists: [NSTextList]) -> Component {
let paragraphStyle = getMutableParagraphStyle()
paragraphStyle.textLists = textLists
return self.paragraphStyle(paragraphStyle)
}

func tighteningFactorForTruncation(_ tighteningFactorForTruncation: Float) -> Component {
let paragraphStyle = getMutableParagraphStyle()
paragraphStyle.tighteningFactorForTruncation = tighteningFactorForTruncation
return self.paragraphStyle(paragraphStyle)
}
func tighteningFactorForTruncation(_ tighteningFactorForTruncation: Float) -> Component {
let paragraphStyle = getMutableParagraphStyle()
paragraphStyle.tighteningFactorForTruncation = tighteningFactorForTruncation
return self.paragraphStyle(paragraphStyle)
}

func headerLevel(_ headerLevel: Int) -> Component {
let paragraphStyle = getMutableParagraphStyle()
paragraphStyle.headerLevel = headerLevel
return self.paragraphStyle(paragraphStyle)
}
func headerLevel(_ headerLevel: Int) -> Component {
let paragraphStyle = getMutableParagraphStyle()
paragraphStyle.headerLevel = headerLevel
return self.paragraphStyle(paragraphStyle)
}
#endif
}

Expand Down

0 comments on commit 873f3e3

Please sign in to comment.