Skip to content

Commit

Permalink
Bump Prefire to V2 and switch to iOS 17.2 and the iPhone 15 simulator
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanceriu committed Mar 7, 2024
1 parent 19c778b commit d1e93cc
Show file tree
Hide file tree
Showing 18 changed files with 54 additions and 204 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,10 @@ jobs:

- name: Configure Xcode 15
run: |
sudo xcode-select -s /Applications/Xcode_15.0.1.app
echo "Creating Runtimes folder if needed..."
sudo mkdir -p /Library/Developer/CoreSimulator/Profiles/Runtimes
echo "Creating symlink of the iOS 16.4 runtime..."
sudo ln -s /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS\ 16.4.simruntime
sudo xcode-select -s /Applications/Xcode_15.2.app
- name: Run tests
run: xcodebuild test -scheme 'Compound' -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14,OS=16.4' -skipPackagePluginValidation -resultBundlePath Logs/CompoundTests.xcresult
run: xcodebuild test -scheme 'Compound' -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 15,OS=17.2' -skipPackagePluginValidation -resultBundlePath Logs/CompoundTests.xcresult

- name: Zip artifacts
if: failure() # We only care about artefacts if the tests fail
Expand Down
5 changes: 2 additions & 3 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
{
"identity" : "prefire",
"kind" : "remoteSourceControl",
"location" : "https://github.com/BarredEwe/Prefire",
"location" : "https://github.com/BarredEwe/Prefire/",
"state" : {
"revision" : "898a4a9f5d5eb0a0b07adb1a7c89daf0f068b129",
"version" : "1.5.0"
"revision" : "996a192263f8056375eb6809e0ff91f1ace40877"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let package = Package(
.package(url: "https://github.com/element-hq/compound-design-tokens.git", exact: "1.2.0"),
.package(url: "https://github.com/siteline/SwiftUI-Introspect.git", from: "0.9.0"),
.package(url: "https://github.com/SFSafeSymbols/SFSafeSymbols.git", from: "4.1.1"),
.package(url: "https://github.com/BarredEwe/Prefire", from: "1.5.0"),
.package(url: "https://github.com/BarredEwe/Prefire", revision: "996a192263f8056375eb6809e0ff91f1ace40877"),
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.13.0")
],
targets: [
Expand Down
1 change: 1 addition & 0 deletions Sources/Compound/BaseStyles/CompoundButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public struct CompoundButtonStyle_Previews: PreviewProvider, PrefireProvider {
Header(title: "Plain")
}
}
.snapshotWithDefaultPrecision()
}

public static func states(_ size: CompoundButtonStyle.Size) -> some View {
Expand Down
1 change: 1 addition & 0 deletions Sources/Compound/BaseStyles/CompoundToggleStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public struct CompoundToggleStyle_Previews: PreviewProvider, PrefireProvider {
states
}
.padding(32)
.snapshotWithDefaultPrecision()
}

@ViewBuilder
Expand Down
28 changes: 28 additions & 0 deletions Sources/Compound/Extensions/View.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// Copyright 2024 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//


import SwiftUI
import Prefire

extension View {
@inlinable
func snapshotWithDefaultPrecision(delay: TimeInterval = .zero) -> some View {
preference(key: DelayPreferenceKey.self, value: delay)
.preference(key: PrecisionPreferenceKey.self, value: 1.0)
.preference(key: PerceptualPrecisionPreferenceKey.self, value:0.98)
}
}
4 changes: 4 additions & 0 deletions Sources/Compound/Icons/CompoundIcon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,18 @@ struct CompoundIcon_Previews: PreviewProvider, PrefireProvider {
static var previews: some View {
form
.previewDisplayName("Form")
.snapshotWithDefaultPrecision()
buttons
.padding(8)
.previewLayout(.sizeThatFits)
.previewDisplayName("Buttons")
.snapshotWithDefaultPrecision()
accessibilityIcons
.previewDisplayName("Accessibility Icons Only")
.snapshotWithDefaultPrecision()
accessibilityLabels
.previewDisplayName("Accessibility Labels")
.snapshotWithDefaultPrecision()
}

static var accessibilityIcons: some View {
Expand Down
1 change: 1 addition & 0 deletions Sources/Compound/List/ListInlinePicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ struct ListInlinePicker_Previews: PreviewProvider, PrefireProvider {
.labelsHidden()
}
}
.snapshotWithDefaultPrecision()
}
}
}
2 changes: 2 additions & 0 deletions Sources/Compound/List/ListRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ public struct ListRow_Previews: PreviewProvider, PrefireProvider {
othersSection
}
.compoundList()
.snapshotWithDefaultPrecision()
}

static var labels: some View {
Expand Down Expand Up @@ -433,5 +434,6 @@ struct ListRowLoadingSelection_Previews: PreviewProvider, PrefireProvider {
kind: .selection(isSelected: false) { })
}
.compoundList()
.snapshotWithDefaultPrecision()
}
}
2 changes: 2 additions & 0 deletions Sources/Compound/List/ListRowAccessory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ struct ListRowAccessory_Previews: PreviewProvider, PrefireProvider {
.disabled(true)
}
.previewDisplayName("Accessories")
.snapshotWithDefaultPrecision()
}

static func row(title: String, accessory: ListRowAccessory) -> some View {
Expand All @@ -133,5 +134,6 @@ struct MultiUnselectedAccessory_Previews: PreviewProvider, PrefireProvider {
}
}
.previewDisplayName("Fake circle icon")
.snapshotWithDefaultPrecision()
}
}
1 change: 1 addition & 0 deletions Sources/Compound/List/ListRowButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,6 @@ public struct ListRowButtonStyle_Previews: PreviewProvider, PrefireProvider {
.listRowInsets(EdgeInsets())
}
.compoundList()
.snapshotWithDefaultPrecision()
}
}
1 change: 1 addition & 0 deletions Sources/Compound/List/ListRowLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -356,5 +356,6 @@ struct ListRowLabel_Previews: PreviewProvider, PrefireProvider {
}
}
.compoundList()
.snapshotWithDefaultPrecision()
}
}
1 change: 1 addition & 0 deletions Sources/Compound/List/ListRowTrailingSection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ struct ListRowTrailingSection_Previews: PreviewProvider, PrefireProvider {
details
withAccessory
}
.snapshotWithDefaultPrecision()
}

static var details: some View {
Expand Down
2 changes: 2 additions & 0 deletions Sources/Compound/List/ListStyles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ struct ListTextStyles_Previews: PreviewProvider, PrefireProvider {
}
.compoundList()
.previewDisplayName("Form")
.snapshotWithDefaultPrecision()

List {
Section {
Expand All @@ -95,5 +96,6 @@ struct ListTextStyles_Previews: PreviewProvider, PrefireProvider {
}
.compoundList()
.previewDisplayName("List")
.snapshotWithDefaultPrecision()
}
}
2 changes: 2 additions & 0 deletions Sources/Compound/Text Field Styles/SearchFieldStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ struct SearchStyle_Previews: PreviewProvider, PrefireProvider {
}
.tint(.compound.textActionPrimary)
.previewDisplayName("List")
.snapshotWithDefaultPrecision()

NavigationStack {
Form {
Expand All @@ -103,5 +104,6 @@ struct SearchStyle_Previews: PreviewProvider, PrefireProvider {
}
.tint(.compound.textActionPrimary)
.previewDisplayName("Form")
.snapshotWithDefaultPrecision()
}
}
5 changes: 2 additions & 3 deletions Tests/.prefire.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
test_configuration:
- template_file_path: PreviewTests.stencil
- simulator_device: "iPhone14"
- required_os: 16
- simulator_device: "iPhone15"
- required_os: 17
190 changes: 0 additions & 190 deletions Tests/PreviewTests.stencil

This file was deleted.

0 comments on commit d1e93cc

Please sign in to comment.