Skip to content

Commit

Permalink
Run swift format
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzalezreal authored and github-actions[bot] committed Jun 16, 2024
1 parent ba61e69 commit 9f6c50f
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 70 deletions.
16 changes: 8 additions & 8 deletions Examples/Demo/Demo/CodeSyntaxHighlightView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
73 changes: 27 additions & 46 deletions Sources/MarkdownUI/Utility/Deprecations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand All @@ -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.
"""
Expand All @@ -85,8 +83,7 @@ extension Theme {
@available(
*,
deprecated,
message:
"""
message: """
Use the version of this function that takes a closure receiving a 'BlockConfiguration'
value.
"""
Expand All @@ -102,8 +99,7 @@ extension Theme {
@available(
*,
deprecated,
message:
"""
message: """
Use the version of this function that takes a closure receiving a 'BlockConfiguration'
value.
"""
Expand All @@ -119,8 +115,7 @@ extension Theme {
@available(
*,
deprecated,
message:
"""
message: """
Use the version of this function that takes a closure receiving a 'BlockConfiguration'
value.
"""
Expand All @@ -136,8 +131,7 @@ extension Theme {
@available(
*,
deprecated,
message:
"""
message: """
Use the version of this function that takes a closure receiving a 'BlockConfiguration'
value.
"""
Expand All @@ -153,8 +147,7 @@ extension Theme {
@available(
*,
deprecated,
message:
"""
message: """
Use the version of this function that takes a closure receiving a 'BlockConfiguration'
value.
"""
Expand All @@ -170,8 +163,7 @@ extension Theme {
@available(
*,
deprecated,
message:
"""
message: """
Use the version of this function that takes a closure receiving a 'BlockConfiguration'
value.
"""
Expand All @@ -187,8 +179,7 @@ extension Theme {
@available(
*,
deprecated,
message:
"""
message: """
Use the version of this function that takes a closure receiving a 'BlockConfiguration'
value.
"""
Expand All @@ -204,8 +195,7 @@ extension Theme {
@available(
*,
deprecated,
message:
"""
message: """
Use the version of this function that takes a closure receiving a 'BlockConfiguration'
value.
"""
Expand All @@ -221,8 +211,7 @@ extension Theme {
@available(
*,
deprecated,
message:
"""
message: """
Use the version of this function that takes a closure receiving a 'CodeBlockConfiguration'
value.
"""
Expand All @@ -240,8 +229,7 @@ extension Theme {
@available(
*,
deprecated,
message:
"""
message: """
Use the version of this function that takes a closure receiving a 'BlockConfiguration'
value.
"""
Expand All @@ -257,8 +245,7 @@ extension Theme {
@available(
*,
deprecated,
message:
"""
message: """
Use the version of this function that takes a closure receiving a 'BlockConfiguration'
value.
"""
Expand All @@ -274,8 +261,7 @@ extension Theme {
@available(
*,
deprecated,
message:
"""
message: """
Use the version of this function that takes a closure receiving a 'BlockConfiguration'
value.
"""
Expand All @@ -291,8 +277,7 @@ extension Theme {
@available(
*,
deprecated,
message:
"""
message: """
Use the version of this function that takes a closure receiving a 'BlockConfiguration'
value.
"""
Expand Down Expand Up @@ -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 {
Expand All @@ -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,
Expand All @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
30 changes: 14 additions & 16 deletions Sources/MarkdownUI/Views/Blocks/ListItemView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

0 comments on commit 9f6c50f

Please sign in to comment.