Add package (#50)

This commit is contained in:
noahsmartin 2023-12-26 17:31:16 -08:00 committed by GitHub
parent 76ced9f8e3
commit 897afcde74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 93 additions and 16 deletions

View file

@ -103,6 +103,7 @@
54F15E5429D59D250054690B /* PulseExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54F15E5329D59D250054690B /* PulseExample.swift */; }; 54F15E5429D59D250054690B /* PulseExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54F15E5329D59D250054690B /* PulseExample.swift */; };
54F15E5629D5A0D70054690B /* GlowExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54F15E5529D5A0D70054690B /* GlowExample.swift */; }; 54F15E5629D5A0D70054690B /* GlowExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54F15E5529D5A0D70054690B /* GlowExample.swift */; };
B7A5DA8D2B0E853A0035FC0A /* Pow in Frameworks */ = {isa = PBXBuildFile; productRef = B7A5DA8C2B0E853A0035FC0A /* Pow */; }; B7A5DA8D2B0E853A0035FC0A /* Pow in Frameworks */ = {isa = PBXBuildFile; productRef = B7A5DA8C2B0E853A0035FC0A /* Pow */; };
FA13B8ED2B3BAF5600F58836 /* SnapshotPreferences in Frameworks */ = {isa = PBXBuildFile; productRef = FA13B8EC2B3BAF5600F58836 /* SnapshotPreferences */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
@ -212,6 +213,7 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
B7A5DA8D2B0E853A0035FC0A /* Pow in Frameworks */, B7A5DA8D2B0E853A0035FC0A /* Pow in Frameworks */,
FA13B8ED2B3BAF5600F58836 /* SnapshotPreferences in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -420,6 +422,7 @@
name = "Pow Example"; name = "Pow Example";
packageProductDependencies = ( packageProductDependencies = (
B7A5DA8C2B0E853A0035FC0A /* Pow */, B7A5DA8C2B0E853A0035FC0A /* Pow */,
FA13B8EC2B3BAF5600F58836 /* SnapshotPreferences */,
); );
productName = "Pow Example"; productName = "Pow Example";
productReference = 546A2986292A31BB00A80DE2 /* Pow Example.app */; productReference = 546A2986292A31BB00A80DE2 /* Pow Example.app */;
@ -450,6 +453,7 @@
); );
mainGroup = 546A297D292A31BB00A80DE2; mainGroup = 546A297D292A31BB00A80DE2;
packageReferences = ( packageReferences = (
FA13B8EB2B3BAF5600F58836 /* XCRemoteSwiftPackageReference "SnapshotPreviews-iOS" */,
); );
productRefGroup = 546A2987292A31BB00A80DE2 /* Products */; productRefGroup = 546A2987292A31BB00A80DE2 /* Products */;
projectDirPath = ""; projectDirPath = "";
@ -777,11 +781,27 @@
}; };
/* End XCConfigurationList section */ /* End XCConfigurationList section */
/* Begin XCRemoteSwiftPackageReference section */
FA13B8EB2B3BAF5600F58836 /* XCRemoteSwiftPackageReference "SnapshotPreviews-iOS" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/EmergeTools/SnapshotPreviews-iOS";
requirement = {
kind = exactVersion;
version = 0.7.6;
};
};
/* End XCRemoteSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */ /* Begin XCSwiftPackageProductDependency section */
B7A5DA8C2B0E853A0035FC0A /* Pow */ = { B7A5DA8C2B0E853A0035FC0A /* Pow */ = {
isa = XCSwiftPackageProductDependency; isa = XCSwiftPackageProductDependency;
productName = Pow; productName = Pow;
}; };
FA13B8EC2B3BAF5600F58836 /* SnapshotPreferences */ = {
isa = XCSwiftPackageProductDependency;
package = FA13B8EB2B3BAF5600F58836 /* XCRemoteSwiftPackageReference "SnapshotPreviews-iOS" */;
productName = SnapshotPreferences;
};
/* End XCSwiftPackageProductDependency section */ /* End XCSwiftPackageProductDependency section */
}; };
rootObject = 546A297E292A31BB00A80DE2 /* Project object */; rootObject = 546A297E292A31BB00A80DE2 /* Project object */;

View file

@ -1,5 +1,6 @@
import Pow import Pow
import SwiftUI import SwiftUI
import SnapshotPreferences
struct CheckoutExample: View, Example { struct CheckoutExample: View, Example {
enum PaymentError: Error { enum PaymentError: Error {
@ -271,5 +272,6 @@ struct CheckoutExample_Previews: PreviewProvider {
CheckoutExample() CheckoutExample()
.toolbar(.visible, for: .navigationBar) .toolbar(.visible, for: .navigationBar)
} }
.emergeSnapshotPrecision(0.99)
} }
} }

View file

@ -3,6 +3,10 @@ fastlane_require 'git'
default_platform(:ios) default_platform(:ios)
def build_for_config(config) def build_for_config(config)
package_file = "../Package.swift"
`sed -i '' 's/let enablePreviews = .*/let enablePreviews = #{config == "Debug" ? "true" : "false"}/' "#{package_file}"`
g = Git.open('.') g = Git.open('.')
build_app( build_app(
project: "./Example/Pow Example.xcodeproj", project: "./Example/Pow Example.xcodeproj",

View file

@ -3,6 +3,8 @@
import PackageDescription import PackageDescription
let enablePreviews = false
let package = Package( let package = Package(
name: "Pow", name: "Pow",
platforms: [ platforms: [
@ -19,13 +21,15 @@ let package = Package(
dependencies: [ dependencies: [
// Dependencies declare other packages that this package depends on. // Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"), // .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/EmergeTools/SnapshotPreviews-iOS", exact: "0.7.6")
], ],
targets: [ targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite. // Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on. // Targets can depend on other targets in this package, and on products in packages this package depends on.
.target( .target(
name: "Pow", name: "Pow",
dependencies: []), dependencies: enablePreviews ? [.product(name: "SnapshotPreferences", package: "SnapshotPreviews-iOS", condition: .when(platforms: [.iOS]))] : [],
swiftSettings: enablePreviews ? [.define("EMG_PREVIEWS")] : nil),
.testTarget( .testTarget(
name: "PowTests", name: "PowTests",
dependencies: ["Pow"]), dependencies: ["Pow"]),

View file

@ -1,5 +1,8 @@
import SwiftUI import SwiftUI
import simd import simd
#if os(iOS) && EMG_PREVIEWS
import SnapshotPreferences
#endif
public extension AnyConditionalEffect { public extension AnyConditionalEffect {
/// An effect that emits smoke from the view. /// An effect that emits smoke from the view.
@ -336,30 +339,35 @@ struct ContinuousParticleEffect_Previews: PreviewProvider {
} }
static var previews: some View { static var previews: some View {
Group {
Preview() Preview()
.preferredColorScheme(.dark) .preferredColorScheme(.dark)
.previewDisplayName("Dark") .previewDisplayName("Dark")
Preview() Preview()
.preferredColorScheme(.light) .preferredColorScheme(.light)
.previewDisplayName("Light") .previewDisplayName("Light")
PreviewS() PreviewS()
.preferredColorScheme(.dark) .preferredColorScheme(.dark)
.previewDisplayName("Small") .previewDisplayName("Small")
Preview2() Preview2()
.preferredColorScheme(.dark) .preferredColorScheme(.dark)
.previewDisplayName("Large") .previewDisplayName("Large")
Preview3() Preview3()
.preferredColorScheme(.dark) .preferredColorScheme(.dark)
.previewDisplayName("Particle Layer") .previewDisplayName("Particle Layer")
#if os(iOS) #if os(iOS)
PreviewLayer() PreviewLayer()
.previewDisplayName("Emitter Layer") .previewDisplayName("Emitter Layer")
#endif #endif
PreviewAlt() PreviewAlt()
.preferredColorScheme(.dark) .preferredColorScheme(.dark)
.previewDisplayName("Emitter Dark") .previewDisplayName("Emitter Dark")
}
#if os(iOS) && EMG_PREVIEWS
.emergeSnapshotPrecision(0)
#endif
} }
} }
#endif #endif

View file

@ -1,4 +1,7 @@
import SwiftUI import SwiftUI
#if os(iOS) && EMG_PREVIEWS
import SnapshotPreferences
#endif
public extension AnyTransition.MovingParts { public extension AnyTransition.MovingParts {
/// A transition that drops the view down from the top. /// A transition that drops the view down from the top.
@ -280,6 +283,9 @@ struct Anvil_Previews: PreviewProvider {
.navigationBarHidden(true) .navigationBarHidden(true)
} }
.environment(\.colorScheme, .dark) .environment(\.colorScheme, .dark)
#if os(iOS) && EMG_PREVIEWS
.emergeSnapshotPrecision(0)
#endif
} }
} }
#endif #endif

View file

@ -1,4 +1,7 @@
import SwiftUI import SwiftUI
#if os(iOS) && EMG_PREVIEWS
import SnapshotPreferences
#endif
public extension AnyTransition.MovingParts { public extension AnyTransition.MovingParts {
/// A transition that moves the view down with any overshoot resulting in an /// A transition that moves the view down with any overshoot resulting in an
@ -218,6 +221,9 @@ struct Bounce_Previews: PreviewProvider {
.navigationBarHidden(true) .navigationBarHidden(true)
} }
.environment(\.colorScheme, .dark) .environment(\.colorScheme, .dark)
#if os(iOS) && EMG_PREVIEWS
.emergeSnapshotPrecision(0)
#endif
} }
} }
@ -290,6 +296,9 @@ struct Boing_2_Previews: PreviewProvider {
NavigationView { NavigationView {
Preview() Preview()
} }
#if os(iOS) && EMG_PREVIEWS
.emergeSnapshotPrecision(0)
#endif
} }
} }
#endif #endif

View file

@ -1,4 +1,7 @@
import SwiftUI import SwiftUI
#if os(iOS) && EMG_PREVIEWS
import SnapshotPreferences
#endif
public extension AnyTransition.MovingParts { public extension AnyTransition.MovingParts {
/// A transition using a clockwise sweep around the centerpoint of the view. /// A transition using a clockwise sweep around the centerpoint of the view.
@ -225,6 +228,9 @@ struct Clock_Previews: PreviewProvider {
.navigationBarHidden(true) .navigationBarHidden(true)
} }
.environment(\.colorScheme, .dark) .environment(\.colorScheme, .dark)
#if os(iOS) && EMG_PREVIEWS
.emergeSnapshotPrecision(0)
#endif
} }
} }
#endif #endif

View file

@ -1,4 +1,7 @@
import SwiftUI import SwiftUI
#if os(iOS) && EMG_PREVIEWS
import SnapshotPreferences
#endif
public extension AnyTransition.MovingParts { public extension AnyTransition.MovingParts {
/// A transitions that shows the view by combining a diagonal wipe with a /// A transitions that shows the view by combining a diagonal wipe with a
@ -254,6 +257,9 @@ struct Glare_Previews: PreviewProvider {
.navigationBarHidden(true) .navigationBarHidden(true)
} }
.environment(\.colorScheme, .dark) .environment(\.colorScheme, .dark)
#if os(iOS) && EMG_PREVIEWS
.emergeSnapshotPrecision(0)
#endif
} }
} }
#endif #endif

View file

@ -1,4 +1,7 @@
import SwiftUI import SwiftUI
#if os(iOS) && EMG_PREVIEWS
import SnapshotPreferences
#endif
public extension AnyTransition.MovingParts { public extension AnyTransition.MovingParts {
/// The direction from which to animate in during a `skid` transition's insertion. /// The direction from which to animate in during a `skid` transition's insertion.
@ -182,6 +185,9 @@ struct Skid_Previews: PreviewProvider {
.navigationBarHidden(true) .navigationBarHidden(true)
} }
.environment(\.colorScheme, .dark) .environment(\.colorScheme, .dark)
#if os(iOS) && EMG_PREVIEWS
.emergeSnapshotPrecision(0)
#endif
} }
} }

View file

@ -1,4 +1,7 @@
import SwiftUI import SwiftUI
#if os(iOS) && EMG_PREVIEWS
import SnapshotPreferences
#endif
public extension AnyTransition.MovingParts { public extension AnyTransition.MovingParts {
/// A transition that dissolves the view into many small particles. /// A transition that dissolves the view into many small particles.
@ -236,6 +239,9 @@ struct Vanish_Previews: PreviewProvider {
.navigationBarHidden(true) .navigationBarHidden(true)
} }
.environment(\.colorScheme, .dark) .environment(\.colorScheme, .dark)
#if os(iOS) && EMG_PREVIEWS
.emergeSnapshotPrecision(0)
#endif
} }
} }
#endif #endif