Skip to content

Commit 175af75

Browse files
committed
Remove not needed returns
1 parent f1baa58 commit 175af75

File tree

5 files changed

+28
-45
lines changed

5 files changed

+28
-45
lines changed

Sources/RichTextKit/Colors/RichTextColor.swift

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,10 @@ public extension RichTextColor {
3838

3939
/// The unique color ID.
4040
var id: String { rawValue }
41-
41+
4242
/// All relevant cases.
4343
static var allCases: [RichTextColor] {
44-
[
45-
.foreground,
46-
.background,
47-
.strikethrough,
48-
.stroke,
49-
.underline
50-
]
44+
[.foreground, .background, .strikethrough, .stroke, .underline]
5145
}
5246

5347
/// The corresponding rich text attribute, if any.
@@ -80,18 +74,8 @@ public extension RichTextColor {
8074
for scheme: ColorScheme
8175
) -> Color {
8276
switch self {
83-
case .background: return color ?? .clear
84-
default: return color ?? .primary
77+
case .background: color ?? .clear
78+
default: color ?? .primary
8579
}
8680
}
8781
}
88-
89-
public extension Collection where Element == RichTextColor {
90-
static var all: [RichTextColor] { Element.allCases - .undefined }
91-
}
92-
93-
extension Array where Element == RichTextColor {
94-
static func - (lhs: [RichTextColor], rhs: RichTextColor) -> [RichTextColor] {
95-
return lhs.filter { $0 != rhs }
96-
}
97-
}

Sources/RichTextKit/Context/RichTextContext+Actions.swift

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,16 @@ public extension RichTextContext {
2323
/// Check if the context can handle a certain action.
2424
func canHandle(_ action: RichTextAction) -> Bool {
2525
switch action {
26-
case .copy: return canCopy
27-
case .dismissKeyboard: return true
28-
case .print: return false
29-
case .redoLatestChange: return canRedoLatestChange
30-
case .setAlignment: return true
31-
case .stepFontSize: return true
32-
case .stepIndent(let points):
33-
return points < 0 ? canDecreaseIndent : canIncreaseIndent
34-
case .stepSuperscript: return false
35-
case .toggleStyle: return true
36-
case .undoLatestChange: return canUndoLatestChange
26+
case .copy: canCopy
27+
case .dismissKeyboard: true
28+
case .print: false
29+
case .redoLatestChange: canRedoLatestChange
30+
case .setAlignment: true
31+
case .stepFontSize: true
32+
case .stepIndent(let points): points < 0 ? canDecreaseIndent : canIncreaseIndent
33+
case .stepSuperscript: false
34+
case .toggleStyle: true
35+
case .undoLatestChange: canUndoLatestChange
3736
}
3837
}
3938
}

Sources/RichTextKit/Context/RichTextContext+Colors.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ public extension RichTextContext {
2121
/// Get the value for a certain color.
2222
func color(for val: RichTextColor) -> ColorRepresentable? {
2323
switch val {
24-
case .foreground: return foregroundColor
25-
case .background: return backgroundColor
26-
case .strikethrough: return strikethroughColor
27-
case .stroke: return strokeColor
28-
case .underline: return underlineColor
29-
case .undefined: return nil
24+
case .foreground: foregroundColor
25+
case .background: backgroundColor
26+
case .strikethrough: strikethroughColor
27+
case .stroke: strokeColor
28+
case .underline: underlineColor
29+
case .undefined: nil
3030
}
3131
}
3232

Sources/RichTextKit/Context/RichTextContext+Styles.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ public extension RichTextContext {
2121
/// Check whether or not the context has a certain style.
2222
func hasStyle(_ style: RichTextStyle) -> Bool {
2323
switch style {
24-
case .bold: return isBold
25-
case .italic: return isItalic
26-
case .underlined: return isUnderlined
27-
case .strikethrough: return isStrikethrough
24+
case .bold: isBold
25+
case .italic: isItalic
26+
case .underlined: isUnderlined
27+
case .strikethrough: isStrikethrough
2828
}
2929
}
3030

Sources/RichTextKit/Images/RichTextImageAttachmentSize.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ public extension RichTextImageAttachmentSize {
2828
*/
2929
func height(in frame: CGRect) -> CGFloat {
3030
switch self {
31-
case .frame: return frame.height
32-
case .points(let points): return points
31+
case .frame: frame.height
32+
case .points(let points): points
3333
}
3434
}
3535

@@ -38,8 +38,8 @@ public extension RichTextImageAttachmentSize {
3838
*/
3939
func width(in frame: CGRect) -> CGFloat {
4040
switch self {
41-
case .frame: return frame.width
42-
case .points(let points): return points
41+
case .frame: frame.width
42+
case .points(let points): points
4343
}
4444
}
4545
}

0 commit comments

Comments
 (0)