diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8651187..9284bed 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,10 +6,13 @@ on: branches: - main +env: + DEVELOPER_DIR: /Applications/Xcode_26.1.1.app/Contents/Developer + jobs: carthage: name: Carthage - runs-on: macos-15 + runs-on: macos-latest steps: - uses: actions/checkout@v4 - name: Build @@ -22,7 +25,7 @@ jobs: ${{ runner.os }}-carthage- spm: name: SPM - runs-on: macos-15 + runs-on: macos-latest steps: - uses: actions/checkout@v4 - name: Build diff --git a/.github/workflows/docbuild.yml b/.github/workflows/docbuild.yml index e0567f9..f21bf9f 100644 --- a/.github/workflows/docbuild.yml +++ b/.github/workflows/docbuild.yml @@ -14,6 +14,9 @@ concurrency: group: "pages" cancel-in-progress: true +env: + DEVELOPER_DIR: /Applications/Xcode_26.1.1.app/Contents/Developer + jobs: # Single deploy job since we're just deploying deploy: @@ -21,7 +24,7 @@ jobs: # Must be set to this for deploying to GitHub Pages name: github-pages url: ${{ steps.deployment.outputs.page_url }} - runs-on: macos-15 + runs-on: macos-latest steps: - name: Checkout 🛎️ uses: actions/checkout@v4 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6f5f25e..fe4c6bc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,10 +2,13 @@ name: Tests on: [workflow_call] +env: + DEVELOPER_DIR: /Applications/Xcode_26.1.1.app/Contents/Developer + jobs: xcodebuild: name: Xcodebuild - runs-on: macos-15 + runs-on: macos-latest env: IOS_DEVICE: iPhone 16 Pro steps: @@ -47,7 +50,7 @@ jobs: path: Tests-tvOS.xcresult spm: name: SPM - runs-on: macos-15 + runs-on: macos-latest steps: - uses: actions/checkout@v4 - name: SPM build diff --git a/.github/xcode-version b/.github/xcode-version deleted file mode 100644 index 441e3fb..0000000 --- a/.github/xcode-version +++ /dev/null @@ -1 +0,0 @@ -15.4 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f4171a..8b3f1da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ ## Next +- Update `font(_:lineHeight:textStyle:)` viewModifier to use native [`lineHeight`](https://developer.apple.com/documentation/swiftui/environmentvalues/lineheight) on +26.0 systems ([#154](https://github.com/AckeeCZ/ACKategories/pull/154), kudos to @olejnjak) + ## 6.16.0 - Add SwiftUI extension `View+FrameSize` ([#153](https://github.com/AckeeCZ/ACKategories/pull/153), kudos to @lukashromadnik) diff --git a/Sources/ACKategories/SwiftUIExtensions/FontModifier.swift b/Sources/ACKategories/SwiftUIExtensions/FontModifier.swift index 55e6ce9..be6e161 100644 --- a/Sources/ACKategories/SwiftUIExtensions/FontModifier.swift +++ b/Sources/ACKategories/SwiftUIExtensions/FontModifier.swift @@ -10,6 +10,8 @@ public extension View { /// - 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. + /// + /// On iOS 26 and above uses native [lineHeight](https://developer.apple.com/documentation/swiftui/environmentvalues/lineheight) view modifier. @ViewBuilder func font( _ font: UIFont, lineHeight: Double?, @@ -19,7 +21,10 @@ public extension View { let customFont = textStyle .map { Font.custom(font.fontName, size: font.pointSize, relativeTo: $0) } ?? Font(font) - if let lineHeight { + if #available(iOS 26.0, tvOS 26.0, watchOS 26.0, *), let lineHeight { + self.font(customFont) + .lineHeight(.exact(points: lineHeight)) + } else if let lineHeight { self.font(customFont) .lineSpacing(lineHeight - font.lineHeight) .padding(.vertical, (lineHeight - font.lineHeight) / 2)