Skip to content

Commit

Permalink
fix macos
Browse files Browse the repository at this point in the history
  • Loading branch information
philippzagar committed Jan 21, 2025
1 parent bc0295d commit ba8b40a
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,23 @@ extension ConsentDocument {
/// - headerTitleFont: The font used for the header title.
/// - headerExportTimeStampFont: The font used for the header timestamp.
public init(
signatureNameFont: UIFont,
signaturePrefixFont: UIFont,
documentContentFont: UIFont,
headerTitleFont: UIFont,
headerExportTimeStampFont: UIFont
) {
self.signatureNameFont = signatureNameFont
self.signaturePrefixFont = signaturePrefixFont
self.documentContentFont = documentContentFont
self.headerTitleFont = headerTitleFont
self.headerExportTimeStampFont = headerExportTimeStampFont
}
signatureNameFont: UIFont,
signaturePrefixFont: UIFont,
documentContentFont: UIFont,
headerTitleFont: UIFont,
headerExportTimeStampFont: UIFont
) {
self.signatureNameFont = signatureNameFont
self.signaturePrefixFont = signaturePrefixFont
self.documentContentFont = documentContentFont
self.headerTitleFont = headerTitleFont
self.headerExportTimeStampFont = headerExportTimeStampFont
}
}
#else
/// The ``FontSettings`` store configuration of the fonts used to render the exported
/// consent document, i.e., fonts for the content, title and signature.
public struct FontSettings {
public struct FontSettings: @unchecked Sendable {
/// The font of the name rendered below the signature line.
public let signatureNameFont: NSFont
/// The font of the prefix of the signature ("X" in most cases).
Expand All @@ -107,27 +107,27 @@ extension ConsentDocument {
/// - headerTitleFont: The font used for the header title.
/// - headerExportTimeStampFont: The font used for the header timestamp.
public init(
signatureNameFont: NSFont,
signaturePrefixFont: NSFont,
documentContentFont: NSFont,
headerTitleFont: NSFont,
headerExportTimeStampFont: NSFont
) {
self.signatureNameFont = signatureNameFont
self.signaturePrefixFont = signaturePrefixFont
self.documentContentFont = documentContentFont
self.headerTitleFont = headerTitleFont
self.headerExportTimeStampFont = headerExportTimeStampFont
}
signatureNameFont: NSFont,
signaturePrefixFont: NSFont,
documentContentFont: NSFont,
headerTitleFont: NSFont,
headerExportTimeStampFont: NSFont
) {
self.signatureNameFont = signatureNameFont
self.signaturePrefixFont = signaturePrefixFont
self.documentContentFont = documentContentFont
self.headerTitleFont = headerTitleFont
self.headerExportTimeStampFont = headerExportTimeStampFont
}
}
#endif


let consentTitle: LocalizedStringResource
let paperSize: PaperSize
let includingTimestamp: Bool
let fontSettings: FontSettings
nonisolated(unsafe) let fontSettings: FontSettings

Check warning on line 129 in Sources/SpeziOnboarding/ConsentView/ConsentDocument+ExportConfiguration.swift

View workflow job for this annotation

GitHub Actions / Build and Test UI Tests iPadOS / Test using xcodebuild or run fastlane

'nonisolated(unsafe)' is unnecessary for a constant with 'Sendable' type 'ConsentDocument.ExportConfiguration.FontSettings', consider removing it

Check warning on line 129 in Sources/SpeziOnboarding/ConsentView/ConsentDocument+ExportConfiguration.swift

View workflow job for this annotation

GitHub Actions / Build and Test UI Tests iPadOS / Test using xcodebuild or run fastlane

'nonisolated(unsafe)' is unnecessary for a constant with 'Sendable' type 'ConsentDocument.ExportConfiguration.FontSettings', consider removing it

Check warning on line 129 in Sources/SpeziOnboarding/ConsentView/ConsentDocument+ExportConfiguration.swift

View workflow job for this annotation

GitHub Actions / Build and Test UI Tests iOS / Test using xcodebuild or run fastlane

'nonisolated(unsafe)' is unnecessary for a constant with 'Sendable' type 'ConsentDocument.ExportConfiguration.FontSettings', consider removing it

Check warning on line 129 in Sources/SpeziOnboarding/ConsentView/ConsentDocument+ExportConfiguration.swift

View workflow job for this annotation

GitHub Actions / Build and Test UI Tests iOS / Test using xcodebuild or run fastlane

'nonisolated(unsafe)' is unnecessary for a constant with 'Sendable' type 'ConsentDocument.ExportConfiguration.FontSettings', consider removing it

Check warning on line 129 in Sources/SpeziOnboarding/ConsentView/ConsentDocument+ExportConfiguration.swift

View workflow job for this annotation

GitHub Actions / Build and Test UI Tests visionOS / Test using xcodebuild or run fastlane

'nonisolated(unsafe)' is unnecessary for a constant with 'Sendable' type 'ConsentDocument.ExportConfiguration.FontSettings', consider removing it

Check warning on line 129 in Sources/SpeziOnboarding/ConsentView/ConsentDocument+ExportConfiguration.swift

View workflow job for this annotation

GitHub Actions / Build and Test UI Tests visionOS / Test using xcodebuild or run fastlane

'nonisolated(unsafe)' is unnecessary for a constant with 'Sendable' type 'ConsentDocument.ExportConfiguration.FontSettings', consider removing it

Check warning on line 129 in Sources/SpeziOnboarding/ConsentView/ConsentDocument+ExportConfiguration.swift

View workflow job for this annotation

GitHub Actions / Build and Test Swift Package iOS (Debug, SpeziOnboarding-iOS.xcresult, SpeziOnboarding-iOS.xcresult) / Test using xcodebuild or run fastlane

'nonisolated(unsafe)' is unnecessary for a constant with 'Sendable' type 'ConsentDocument.ExportConfiguration.FontSettings', consider removing it

Check warning on line 129 in Sources/SpeziOnboarding/ConsentView/ConsentDocument+ExportConfiguration.swift

View workflow job for this annotation

GitHub Actions / Build and Test Swift Package iOS (Debug, SpeziOnboarding-iOS.xcresult, SpeziOnboarding-iOS.xcresult) / Test using xcodebuild or run fastlane

'nonisolated(unsafe)' is unnecessary for a constant with 'Sendable' type 'ConsentDocument.ExportConfiguration.FontSettings', consider removing it

Check warning on line 129 in Sources/SpeziOnboarding/ConsentView/ConsentDocument+ExportConfiguration.swift

View workflow job for this annotation

GitHub Actions / Build and Test Swift Package iOS (Release, SpeziOnboarding-iOS-Release.xcresult, SpeziOnboarding-... / Test using xcodebuild or run fastlane

'nonisolated(unsafe)' is unnecessary for a constant with 'Sendable' type 'ConsentDocument.ExportConfiguration.FontSettings', consider removing it

Check warning on line 129 in Sources/SpeziOnboarding/ConsentView/ConsentDocument+ExportConfiguration.swift

View workflow job for this annotation

GitHub Actions / Build and Test Swift Package macOS (Debug, SpeziOnboarding-macOS.xcresult, SpeziOnboarding-macOS.... / Test using xcodebuild or run fastlane

'nonisolated(unsafe)' is unnecessary for a constant with 'Sendable' type 'ConsentDocument.ExportConfiguration.FontSettings', consider removing it

Check warning on line 129 in Sources/SpeziOnboarding/ConsentView/ConsentDocument+ExportConfiguration.swift

View workflow job for this annotation

GitHub Actions / Build and Test Swift Package macOS (Debug, SpeziOnboarding-macOS.xcresult, SpeziOnboarding-macOS.... / Test using xcodebuild or run fastlane

'nonisolated(unsafe)' is unnecessary for a constant with 'Sendable' type 'ConsentDocument.ExportConfiguration.FontSettings', consider removing it

Check warning on line 129 in Sources/SpeziOnboarding/ConsentView/ConsentDocument+ExportConfiguration.swift

View workflow job for this annotation

GitHub Actions / Build and Test Swift Package macOS (Release, SpeziOnboarding-macOS-Release.xcresult, SpeziOnboard... / Test using xcodebuild or run fastlane

'nonisolated(unsafe)' is unnecessary for a constant with 'Sendable' type 'ConsentDocument.ExportConfiguration.FontSettings', consider removing it

Check warning on line 129 in Sources/SpeziOnboarding/ConsentView/ConsentDocument+ExportConfiguration.swift

View workflow job for this annotation

GitHub Actions / Build and Test Swift Package visionOS (Debug, SpeziOnboarding-visionOS.xcresult, SpeziOnboarding-... / Test using xcodebuild or run fastlane

'nonisolated(unsafe)' is unnecessary for a constant with 'Sendable' type 'ConsentDocument.ExportConfiguration.FontSettings', consider removing it

Check warning on line 129 in Sources/SpeziOnboarding/ConsentView/ConsentDocument+ExportConfiguration.swift

View workflow job for this annotation

GitHub Actions / Build and Test Swift Package visionOS (Debug, SpeziOnboarding-visionOS.xcresult, SpeziOnboarding-... / Test using xcodebuild or run fastlane

'nonisolated(unsafe)' is unnecessary for a constant with 'Sendable' type 'ConsentDocument.ExportConfiguration.FontSettings', consider removing it

Check warning on line 129 in Sources/SpeziOnboarding/ConsentView/ConsentDocument+ExportConfiguration.swift

View workflow job for this annotation

GitHub Actions / Build and Test Swift Package visionOS (Release, SpeziOnboarding-visionOS-Release.xcresult, SpeziO... / Test using xcodebuild or run fastlane

'nonisolated(unsafe)' is unnecessary for a constant with 'Sendable' type 'ConsentDocument.ExportConfiguration.FontSettings', consider removing it


/// Creates an `ExportConfiguration` specifying the properties of the exported consent form.
/// - Parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,55 +9,56 @@
import Foundation
import SwiftUI


extension ConsentDocument.ExportConfiguration {
/// Provides default values for fields related to the `ConsentDocumentExportConfiguration`.
public enum Defaults {
#if !os(macOS)
/// Default export font settings with fixed font sizes, ensuring a consistent appearance across platforms.
///
/// This configuration uses `systemFont` and `boldSystemFont` with absolute font sizes to achieve uniform font sizes
/// on different operating systems such as macOS, iOS, and visionOS.
public static let defaultExportFontSettings = FontSettings(
signatureNameFont: UIFont.systemFont(ofSize: 10),
signaturePrefixFont: UIFont.boldSystemFont(ofSize: 12),
documentContentFont: UIFont.systemFont(ofSize: 12),
headerTitleFont: UIFont.boldSystemFont(ofSize: 28),
headerExportTimeStampFont: UIFont.systemFont(ofSize: 8)
)
/// Default font based on system standards. In contrast to defaultExportFontSettings,
/// the font sizes might change according to the system settings, potentially leading to varying exported PDF documents
/// on devices with different system settings (e.g., larger default font size).
public static let defaultSystemDefaultFontSettings = FontSettings(
signatureNameFont: UIFont.preferredFont(forTextStyle: .subheadline),
signaturePrefixFont: UIFont.preferredFont(forTextStyle: .title2),
documentContentFont: UIFont.preferredFont(forTextStyle: .body),
headerTitleFont: UIFont.boldSystemFont(ofSize: UIFont.preferredFont(forTextStyle: .largeTitle).pointSize),
headerExportTimeStampFont: UIFont.preferredFont(forTextStyle: .caption1)
)
#else
/// Default export font settings with fixed font sizes, ensuring a consistent appearance across platforms.
///
/// This configuration uses `systemFont` and `boldSystemFont` with absolute font sizes to achieve uniform font sizes
/// on different operating systems such as macOS, iOS, and visionOS.
public static let defaultExportFontSettings = FontSettings(
signatureNameFont: NSFont.systemFont(ofSize: 10),
signaturePrefixFont: NSFont.boldSystemFont(ofSize: 12),
documentContentFont: NSFont.systemFont(ofSize: 12),
headerTitleFont: NSFont.boldSystemFont(ofSize: 28),
headerExportTimeStampFont: NSFont.systemFont(ofSize: 8)
)
/// Default font based on system standards. In contrast to defaultExportFontSettings,
/// the font sizes might change according to the system settings, potentially leading to varying exported PDF documents
/// on devices with different system settings (e.g., larger default font size).
public static let defaultSystemDefaultFontSettings = FontSettings(
signatureNameFont: NSFont.preferredFont(forTextStyle: .subheadline),
signaturePrefixFont: NSFont.preferredFont(forTextStyle: .title2),
documentContentFont: NSFont.preferredFont(forTextStyle: .body),
headerTitleFont: NSFont.boldSystemFont(ofSize: NSFont.preferredFont(forTextStyle: .largeTitle).pointSize),
headerExportTimeStampFont: NSFont.preferredFont(forTextStyle: .caption1)
)
#endif
}
#if !os(macOS)
/// Default export font settings with fixed font sizes, ensuring a consistent appearance across platforms.
///
/// This configuration uses `systemFont` and `boldSystemFont` with absolute font sizes to achieve uniform font sizes
/// on different operating systems such as macOS, iOS, and visionOS.
public static let defaultExportFontSettings = FontSettings(
signatureNameFont: UIFont.systemFont(ofSize: 10),
signaturePrefixFont: UIFont.boldSystemFont(ofSize: 12),
documentContentFont: UIFont.systemFont(ofSize: 12),
headerTitleFont: UIFont.boldSystemFont(ofSize: 28),
headerExportTimeStampFont: UIFont.systemFont(ofSize: 8)
)

/// Default font based on system standards. In contrast to defaultExportFontSettings,
/// the font sizes might change according to the system settings, potentially leading to varying exported PDF documents
/// on devices with different system settings (e.g., larger default font size).
public static let defaultSystemDefaultFontSettings = FontSettings(
signatureNameFont: UIFont.preferredFont(forTextStyle: .subheadline),
signaturePrefixFont: UIFont.preferredFont(forTextStyle: .title2),
documentContentFont: UIFont.preferredFont(forTextStyle: .body),
headerTitleFont: UIFont.boldSystemFont(ofSize: UIFont.preferredFont(forTextStyle: .largeTitle).pointSize),
headerExportTimeStampFont: UIFont.preferredFont(forTextStyle: .caption1)
)
#else
/// Default export font settings with fixed font sizes, ensuring a consistent appearance across platforms.
///
/// This configuration uses `systemFont` and `boldSystemFont` with absolute font sizes to achieve uniform font sizes
/// on different operating systems such as macOS, iOS, and visionOS.
public static let defaultExportFontSettings = FontSettings(
signatureNameFont: NSFont.systemFont(ofSize: 10),
signaturePrefixFont: NSFont.boldSystemFont(ofSize: 12),
documentContentFont: NSFont.systemFont(ofSize: 12),
headerTitleFont: NSFont.boldSystemFont(ofSize: 28),
headerExportTimeStampFont: NSFont.systemFont(ofSize: 8)
)

/// Default font based on system standards. In contrast to defaultExportFontSettings,
/// the font sizes might change according to the system settings, potentially leading to varying exported PDF documents
/// on devices with different system settings (e.g., larger default font size).
public static let defaultSystemDefaultFontSettings = FontSettings(
signatureNameFont: NSFont.preferredFont(forTextStyle: .subheadline),
signaturePrefixFont: NSFont.preferredFont(forTextStyle: .title2),
documentContentFont: NSFont.preferredFont(forTextStyle: .body),
headerTitleFont: NSFont.boldSystemFont(ofSize: NSFont.preferredFont(forTextStyle: .largeTitle).pointSize),
headerExportTimeStampFont: NSFont.preferredFont(forTextStyle: .caption1)
)
#endif
}
}

0 comments on commit ba8b40a

Please sign in to comment.