diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 1f3dccdc..1b468473 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -14,6 +14,7 @@ jobs: changelog: name: Changelog runs-on: ubuntu-latest + if: ${{ !github.event.pull_request.head.repo.fork }} steps: - uses: actions/checkout@v4 - name: Changelog Reminder diff --git a/ACKategories-iOS/SwiftUIExtensions/FontModifier.swift b/ACKategories-iOS/SwiftUIExtensions/FontModifier.swift new file mode 100644 index 00000000..2cbbe7bd --- /dev/null +++ b/ACKategories-iOS/SwiftUIExtensions/FontModifier.swift @@ -0,0 +1,34 @@ +import SwiftUI + +@available(iOS 14.0, *) +extension View { + /// Sets font and line height for text in this view. + /// + /// - Parameters: + /// - font: The font to use in this view. + /// - lineHeight: The line height to use in this view. + /// - textStyle: The text style for relative font scaling. If `nil`is specified then dynamic type is turned off. + func font( + _ font: UIFont, + lineHeight: Double, + textStyle: Font.TextStyle? + ) -> some View { + let customFont: Font + + // Do not scale font based on dynamic type when nil `relativeTo` specified + if let textStyle = textStyle { + customFont = .custom( + font.fontName, + size: font.pointSize, + relativeTo: textStyle + ) + } else { + customFont = Font(font) + } + + return self + .font(customFont) + .lineSpacing(lineHeight - font.lineHeight) + .padding(.vertical, (lineHeight - font.lineHeight) / 2) + } +} diff --git a/ACKategories-iOS/UIView+Spacer.swift b/ACKategories-iOS/UIView+Spacer.swift index 7fad1855..9d7e4ec4 100644 --- a/ACKategories-iOS/UIView+Spacer.swift +++ b/ACKategories-iOS/UIView+Spacer.swift @@ -5,7 +5,7 @@ import UIKit public extension UIView { private final class Spacer: UIView { fileprivate var observation: NSKeyValueObservation? - + init( size: CGFloat, axis: NSLayoutConstraint.Axis, @@ -18,9 +18,9 @@ public extension UIView { height: axis == .vertical ? size : 0 ) )) - + translatesAutoresizingMaskIntoConstraints = false - + switch axis { case .horizontal: let constraint = widthAnchor.constraint(equalToConstant: size) @@ -33,12 +33,12 @@ public extension UIView { default: assertionFailure("Unknown axis \(axis)") } } - + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } } - + private func createSpacer(_ size: CGFloat, axis: NSLayoutConstraint.Axis, priority: Float) -> UIView { let spacer = Spacer(size: size, axis: axis, priority: priority) spacer.isHidden = isHidden @@ -58,4 +58,3 @@ public extension UIView { createSpacer(width, axis: .horizontal, priority: priority) } } - diff --git a/ACKategories.xcodeproj/project.pbxproj b/ACKategories.xcodeproj/project.pbxproj index 732ebe3a..2080bdf5 100644 --- a/ACKategories.xcodeproj/project.pbxproj +++ b/ACKategories.xcodeproj/project.pbxproj @@ -107,6 +107,7 @@ 69FA5FBD23C868A900B44BCD /* ModalFlowCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69FA5FAC23C868A900B44BCD /* ModalFlowCoordinator.swift */; }; 69FA5FC223C8690A00B44BCD /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 69FA5FC123C8690A00B44BCD /* LaunchScreen.storyboard */; }; 6A31C9F3250572FE0047A983 /* SelfSizingTableHeaderFooterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A31C9F2250572FE0047A983 /* SelfSizingTableHeaderFooterView.swift */; }; + 6A572DB92ADE89B0002BD518 /* FontModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A572DB82ADE89B0002BD518 /* FontModifier.swift */; }; 88EDD90425B8252E00207987 /* GradientViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88EDD90325B8252E00207987 /* GradientViewController.swift */; }; A33559012555270F009B9D89 /* FlowCoordinatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A33559002555270F009B9D89 /* FlowCoordinatorTests.swift */; }; A38883E3257E2D2D00B958DD /* ErrorHandlers.swift in Sources */ = {isa = PBXBuildFile; fileRef = A38883E2257E2D2D00B958DD /* ErrorHandlers.swift */; }; @@ -265,6 +266,7 @@ 69FA5FC323C869A200B44BCD /* ACKategories.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; path = ACKategories.podspec; sourceTree = ""; }; 69FA5FE423C8712D00B44BCD /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = ""; }; 6A31C9F2250572FE0047A983 /* SelfSizingTableHeaderFooterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelfSizingTableHeaderFooterView.swift; sourceTree = ""; }; + 6A572DB82ADE89B0002BD518 /* FontModifier.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FontModifier.swift; sourceTree = ""; }; 88EDD90325B8252E00207987 /* GradientViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GradientViewController.swift; sourceTree = ""; }; A33559002555270F009B9D89 /* FlowCoordinatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlowCoordinatorTests.swift; sourceTree = ""; }; A38883E2257E2D2D00B958DD /* ErrorHandlers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ErrorHandlers.swift; sourceTree = ""; }; @@ -450,6 +452,8 @@ 69E81A0823C773370054687B /* ACKategories-iOS */ = { isa = PBXGroup; children = ( + 6950963023C7747C00E8F457 /* Base */, + 6A572DB72ADE8994002BD518 /* SwiftUIExtensions */, 697CECF023C877B20019FE61 /* Aliases.swift */, A38883E2257E2D2D00B958DD /* ErrorHandlers.swift */, 6950964823C7751600E8F457 /* GradientView.swift */, @@ -475,7 +479,6 @@ 6984CE122A5C218A001EE958 /* UIViewController+FrontMost.swift */, 6950966723C78AC800E8F457 /* UIViewController+SafeAreaCompat.swift */, 6950966323C78AC800E8F457 /* UIViewExtensions.swift */, - 6950963023C7747C00E8F457 /* Base */, 6950963523C7749F00E8F457 /* Supporting files */, ); path = "ACKategories-iOS"; @@ -588,6 +591,14 @@ path = "Flow coordinators"; sourceTree = ""; }; + 6A572DB72ADE8994002BD518 /* SwiftUIExtensions */ = { + isa = PBXGroup; + children = ( + 6A572DB82ADE89B0002BD518 /* FontModifier.swift */, + ); + path = SwiftUIExtensions; + sourceTree = ""; + }; 88EDD8FD25B824C200207987 /* GradientView */ = { isa = PBXGroup; children = ( @@ -774,8 +785,9 @@ 69E819DF23C773010054687B /* Project object */ = { isa = PBXProject; attributes = { + BuildIndependentTargetsInParallel = YES; LastSwiftUpdateCheck = 1130; - LastUpgradeCheck = 1400; + LastUpgradeCheck = 1500; TargetAttributes = { 695096D723C7908B00E8F457 = { CreatedOnToolsVersion = 11.3; @@ -979,6 +991,7 @@ 6950967023C78AC900E8F457 /* UIControlEvents.swift in Sources */, 6950965723C7754D00E8F457 /* Reusable.swift in Sources */, 69F83E972A617A2500E9C8EA /* Combine+Concurrency.swift in Sources */, + 6A572DB92ADE89B0002BD518 /* FontModifier.swift in Sources */, 6950962A23C7740B00E8F457 /* Logger.swift in Sources */, 6950967823C78AC900E8F457 /* UIViewController+Children.swift in Sources */, 6950967223C78AC900E8F457 /* UIViewExtensions.swift in Sources */, @@ -1196,6 +1209,7 @@ DEAD_CODE_STRIPPING = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; @@ -1234,6 +1248,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; DEAD_CODE_STRIPPING = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; @@ -1575,6 +1590,7 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; @@ -1656,6 +1672,7 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; diff --git a/ACKategories.xcodeproj/xcshareddata/xcschemes/ACKategories-iOS.xcscheme b/ACKategories.xcodeproj/xcshareddata/xcschemes/ACKategories-iOS.xcscheme index bad8fc3f..944dd746 100644 --- a/ACKategories.xcodeproj/xcshareddata/xcschemes/ACKategories-iOS.xcscheme +++ b/ACKategories.xcodeproj/xcshareddata/xcschemes/ACKategories-iOS.xcscheme @@ -1,6 +1,6 @@