From 9f6c50ff6355cdde56086364aa6eb65b68ca2158 Mon Sep 17 00:00:00 2001 From: gonzalezreal Date: Sun, 16 Jun 2024 08:29:38 +0000 Subject: [PATCH] Run swift format --- .../Demo/Demo/CodeSyntaxHighlightView.swift | 16 ++-- Sources/MarkdownUI/Utility/Deprecations.swift | 73 +++++++------------ .../Views/Blocks/ListItemView.swift | 30 ++++---- 3 files changed, 49 insertions(+), 70 deletions(-) diff --git a/Examples/Demo/Demo/CodeSyntaxHighlightView.swift b/Examples/Demo/Demo/CodeSyntaxHighlightView.swift index e27a09a6..7377c46e 100644 --- a/Examples/Demo/Demo/CodeSyntaxHighlightView.swift +++ b/Examples/Demo/Demo/CodeSyntaxHighlightView.swift @@ -147,14 +147,14 @@ struct CodeSyntaxHighlightView: View { } private func copyToClipboard(_ string: String) { -#if os(macOS) - if let pasteboard = NSPasteboard.general { - pasteboard.clearContents() - pasteboard.setString(string, forType: .string) - } -#elseif os(iOS) - UIPasteboard.general.string = string -#endif + #if os(macOS) + if let pasteboard = NSPasteboard.general { + pasteboard.clearContents() + pasteboard.setString(string, forType: .string) + } + #elseif os(iOS) + UIPasteboard.general.string = string + #endif } } diff --git a/Sources/MarkdownUI/Utility/Deprecations.swift b/Sources/MarkdownUI/Utility/Deprecations.swift index d05a8864..7a60dffa 100644 --- a/Sources/MarkdownUI/Utility/Deprecations.swift +++ b/Sources/MarkdownUI/Utility/Deprecations.swift @@ -46,8 +46,7 @@ extension View { @available( *, deprecated, - message: - """ + message: """ Use the version of this function that takes a closure receiving a generic 'Configuration' value. """ @@ -62,8 +61,7 @@ extension View { @available( *, deprecated, - message: - """ + message: """ Use the version of this function that takes a closure receiving a generic 'Configuration' value. """ @@ -85,8 +83,7 @@ extension Theme { @available( *, deprecated, - message: - """ + message: """ Use the version of this function that takes a closure receiving a 'BlockConfiguration' value. """ @@ -102,8 +99,7 @@ extension Theme { @available( *, deprecated, - message: - """ + message: """ Use the version of this function that takes a closure receiving a 'BlockConfiguration' value. """ @@ -119,8 +115,7 @@ extension Theme { @available( *, deprecated, - message: - """ + message: """ Use the version of this function that takes a closure receiving a 'BlockConfiguration' value. """ @@ -136,8 +131,7 @@ extension Theme { @available( *, deprecated, - message: - """ + message: """ Use the version of this function that takes a closure receiving a 'BlockConfiguration' value. """ @@ -153,8 +147,7 @@ extension Theme { @available( *, deprecated, - message: - """ + message: """ Use the version of this function that takes a closure receiving a 'BlockConfiguration' value. """ @@ -170,8 +163,7 @@ extension Theme { @available( *, deprecated, - message: - """ + message: """ Use the version of this function that takes a closure receiving a 'BlockConfiguration' value. """ @@ -187,8 +179,7 @@ extension Theme { @available( *, deprecated, - message: - """ + message: """ Use the version of this function that takes a closure receiving a 'BlockConfiguration' value. """ @@ -204,8 +195,7 @@ extension Theme { @available( *, deprecated, - message: - """ + message: """ Use the version of this function that takes a closure receiving a 'BlockConfiguration' value. """ @@ -221,8 +211,7 @@ extension Theme { @available( *, deprecated, - message: - """ + message: """ Use the version of this function that takes a closure receiving a 'CodeBlockConfiguration' value. """ @@ -240,8 +229,7 @@ extension Theme { @available( *, deprecated, - message: - """ + message: """ Use the version of this function that takes a closure receiving a 'BlockConfiguration' value. """ @@ -257,8 +245,7 @@ extension Theme { @available( *, deprecated, - message: - """ + message: """ Use the version of this function that takes a closure receiving a 'BlockConfiguration' value. """ @@ -274,8 +261,7 @@ extension Theme { @available( *, deprecated, - message: - """ + message: """ Use the version of this function that takes a closure receiving a 'BlockConfiguration' value. """ @@ -291,8 +277,7 @@ extension Theme { @available( *, deprecated, - message: - """ + message: """ Use the version of this function that takes a closure receiving a 'BlockConfiguration' value. """ @@ -330,11 +315,10 @@ public typealias InlineCode = Code @available( *, unavailable, - message: + message: """ + "MarkdownImageHandler" has been superseded by the "ImageProvider" protocol and its conforming + types "DefaultImageProvider" and "AssetImageProvider". """ - "MarkdownImageHandler" has been superseded by the "ImageProvider" protocol and its conforming - types "DefaultImageProvider" and "AssetImageProvider". - """ ) public struct MarkdownImageHandler { public static var networkImage: Self { @@ -353,11 +337,10 @@ extension Markdown { @available( *, unavailable, - message: + message: """ + "MarkdownImageHandler" has been superseded by the "ImageProvider" protocol and its conforming + types "DefaultImageProvider" and "AssetImageProvider". """ - "MarkdownImageHandler" has been superseded by the "ImageProvider" protocol and its conforming - types "DefaultImageProvider" and "AssetImageProvider". - """ ) public func setImageHandler( _ imageHandler: MarkdownImageHandler, @@ -381,11 +364,10 @@ extension View { @available( *, unavailable, - message: + message: """ + "MarkdownStyle" and its subtypes have been superseded by the "Theme", "TextStyle", and + "BlockStyle" types. """ - "MarkdownStyle" and its subtypes have been superseded by the "Theme", "TextStyle", and - "BlockStyle" types. - """ ) public struct MarkdownStyle: Hashable { public struct Font: Hashable { @@ -501,11 +483,10 @@ extension View { @available( *, unavailable, - message: + message: """ + "MarkdownStyle" and its subtypes have been superseded by the "Theme", "TextStyle", and + "BlockStyle" types. """ - "MarkdownStyle" and its subtypes have been superseded by the "Theme", "TextStyle", and - "BlockStyle" types. - """ ) public func markdownStyle(_ markdownStyle: MarkdownStyle) -> some View { self diff --git a/Sources/MarkdownUI/Views/Blocks/ListItemView.swift b/Sources/MarkdownUI/Views/Blocks/ListItemView.swift index 69e1d81e..fb5feb9b 100644 --- a/Sources/MarkdownUI/Views/Blocks/ListItemView.swift +++ b/Sources/MarkdownUI/Views/Blocks/ListItemView.swift @@ -41,29 +41,27 @@ struct ListItemView: View { .frame(width: self.markerWidth, alignment: .trailing) } #if os(visionOS) - .labelStyle(BulletItemStyle()) + .labelStyle(BulletItemStyle()) #endif } } - extension VerticalAlignment { - private enum CenterOfFirstLine: AlignmentID { - static func defaultValue(in context: ViewDimensions) -> CGFloat { - let heightAfterFirstLine = context[.lastTextBaseline] - context[.firstTextBaseline] - let heightOfFirstLine = context.height - heightAfterFirstLine - return heightOfFirstLine / 2 - } - } - static let centerOfFirstLine = Self(CenterOfFirstLine.self) + private enum CenterOfFirstLine: AlignmentID { + static func defaultValue(in context: ViewDimensions) -> CGFloat { + let heightAfterFirstLine = context[.lastTextBaseline] - context[.firstTextBaseline] + let heightOfFirstLine = context.height - heightAfterFirstLine + return heightOfFirstLine / 2 + } + } + static let centerOfFirstLine = Self(CenterOfFirstLine.self) } - struct BulletItemStyle: LabelStyle { - func makeBody(configuration: Configuration) -> some View { - HStack(alignment: .centerOfFirstLine, spacing: 4) { - configuration.icon - configuration.title - } + func makeBody(configuration: Configuration) -> some View { + HStack(alignment: .centerOfFirstLine, spacing: 4) { + configuration.icon + configuration.title } + } }