Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/docbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,17 @@ 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:
environment:
# 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
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion .github/xcode-version

This file was deleted.

2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 6 additions & 1 deletion Sources/ACKategories/SwiftUIExtensions/FontModifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?,
Expand All @@ -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)
Expand Down