Install Xcode command line tools
mainBefore installing fastlane, ensure that the latest version of the Xcode command line tools is installed on your system.
xcode-select --installrepository·main·Indexed 26 days ago
https://github.com/emergetools/powA SwiftUI library providing visual and haptic 'Change Effects' that trigger when values change, as well as smooth transitions. Features include a variety of effects like .spray, .jump, .ping, .shake, and .shine, along with specialized transitions accessed via the movingParts namespace such as anvil, blinds, iris, and vanish. Supports iOS 15.0+, macOS 12.0, Mac Catalyst 15.0+, and visionOS beta 6.
Before installing fastlane, ensure that the latest version of the Xcode command line tools is installed on your system.
xcode-select --installSince Pow is now an open-source community project, you no longer need to validate a purchase. You can remove the following line of code from your project:
Pow.unlockPow(reason: .iDidBuyTheLicense)Change Effects trigger a visual or haptic response whenever a monitored value changes. Use the .changeEffect(_:value:isEnabled:) modifier to apply an effect to a view.
Note: You can also chain .delay(seconds) to any effect to postpone its execution.
Button {
post.toggleLike()
} label: {
Label(post.likes.formatted(), systemName: "heart.fill")
}
.changeEffect(.spray { heart }, value: post.likes, isEnabled: post.isLiked)
.tint(post.isLiked ? .red : .gray)To add Pow to your Xcode project, select File > Add Package and enter the repository URL: https://github.com/EmergeTools/Pow.
To add it directly to a Package.swift file, add the dependency and the product as follows:
.package(url: "https://github.com/EmergeTools/Pow", from: Version(1, 0, 0))
// And to your target as a product:
.product(name: "Pow", package: "Pow")To upgrade Pow to version 1.0.0 or higher, you must manually update the package dependency because the transition from 0.x.x to 1.0.0 is a major version bump. Xcode's 'Up to Next Major Version' rule will not perform this update automatically.
Update your package reference to use the new repository URL and the new version number:
Old Reference:
.package(url: "https://github.com/movingparts-io/Pow", from: Version(0, 3, 1))New Reference:
.package(url: "https://github.com/EmergeTools/Pow", from: Version(1, 0, 0))If Swift Package Manager shows errors immediately after the upgrade, this is a known Xcode issue. The solution is to close and re-open Xcode.
Check the 'Package Dependencies' list in your Xcode File Navigator. You should see Pow version 1.0.0, and since the project is now open source, you should be able to see the source code in your project tree.
All Pow transitions are accessed through the movingParts static variable on the AnyTransition type. You apply them to a view using the .transition() modifier.
Example usage:
myView.transition(.movingParts.anvil)myView.transition(.movingParts.anvil)Example folder in this repository contains practical implementations and visual demonstrations of the Pow effects framework for SwiftUI. Use these examples to understand how to integrate various haptic and motion effects into your SwiftUI applications..jump(height:) effect makes the view jump a specified height and bounce before settling.The .spray effect emits multiple particles in different shades and sizes moving up from the origin point.
likeButton
.changeEffect(
.spray(origin: .center) { Image(systemName: "heart.fill") },
value: likes
).shine effect highlights the view with a shine moving from the top leading edge to the bottom trailing edge.Pow provides several ways to trigger haptic feedback:
feedback(hapticNotification type: UINotificationFeedbackGenerator.FeedbackType): Triggers success, failure, or warning notifications.feedback(hapticImpact style: UIImpactFeedbackGenerator.FeedbackStyle): Simulates physical impacts.feedbackHapticSelection: Triggers feedback indicating a change in selection..rise effect emits particles from an origin point that slowly float up while moving side to side.