-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Robert Böhnke <[email protected]> Co-authored-by: Kasper Lahti <[email protected]>
- Loading branch information
1 parent
d5dc837
commit 781d455
Showing
206 changed files
with
13,604 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# 1.0 Update Guide | ||
|
||
If you are moving from a version of Pow below 1.0.0 the first thing you'll notice is that Pow is now open source. 🎉🎉🎉 | ||
|
||
Previously Pow was a paid product, and now it is a a community project operated and sponsored by [Emerge Tools](https://github.com/EmergeTools). | ||
|
||
--- | ||
|
||
> [!NOTE] | ||
> Pow's version number has been bumped from 0.3.1 to 1.0.0, and despite this being a new major version there are **no breaking changes**. | ||
> | ||
> Now that the Pow project is run by EmergeTools you should use the URL https://github.com/EmergeTools/Pow rather than https://github.com/movingparts-io/Pow. | ||
|
||
### Integrate Pow 1.0.0+ into your app. | ||
|
||
If you've integrated Pow through Xcode's Package Dependencies you will need to update the Pow package dependency to point to 1.0.0. | ||
|
||
If you're using the default Up to Next Major Version rule you may need to manually update the version number to 1.0.0. Going from 0.x.x to 1.0.0 is considered a major version update, so Xcode will not do it automatically on your behalf for fear of breaking changes. | ||
|
||
![](./images/pow-version-updated-before.png) | ||
|
||
When you set Pow to version 1.0.0 in your Package Dependencies list it will now look like this. | ||
|
||
![](./images/pow-version-updated-after.png) | ||
|
||
If you're using Swift Package Manager you should update the URL and version number of any references you have to Pow. | ||
|
||
> Before | ||
> ```swift | ||
> .package(url: "https://github.com/movingparts-io/Pow", from: Version(0, 3, 1)) | ||
> ``` | ||
> After | ||
> ```swift | ||
> .package(url: "https://github.com/EmergeTools/Pow", from: Version(1, 0, 0)) | ||
> ``` | ||
Sometimes Swift Package Manager will show errors like this after upgrading a dependency. | ||
![](./images/xcode-errors.png) | ||
This is a long-standing issue with Xcode, not Pow. The solution of course is to close and re-open Xcode. | ||
![](./images/pow-source-after-update.png) | ||
To confirm that Pow has been updated you can look at the list of installed Swift Packages in your project's File Navigator. (The first tab of Xcode's left sidebar.) If everything has gone correctly you will see Pow 1.0.0, and now that the framework is open source you will also see all of the source code. | ||
--- | ||
### Remove Pow's License | ||
Now that Pow is free, you too are free to remove this line of code that would validate your purchase of a Pow license. | ||
```swift | ||
Pow.unlockPow(reason: .iDidBuyTheLicense) | ||
``` | ||
--- | ||
|
||
And that's it, easy as 0.1, 0.2, 0.3. If you run into any problems upgrading please file an [issue](gihtub.com/EmergeTools/Pow/issues), we're more than happy to help. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
Example/Pow Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
Example/Pow Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
11 changes: 11 additions & 0 deletions
11
Example/Pow Example/Assets.xcassets/AccentColor.colorset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"colors" : [ | ||
{ | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
Example/Pow Example/Assets.xcassets/AppIcon.appiconset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "icon.png", | ||
"idiom" : "universal", | ||
"platform" : "ios", | ||
"size" : "1024x1024" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
Example/Pow Example/Assets.xcassets/disco.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "disco.jpg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions
12
Example/Pow Example/Assets.xcassets/mvp.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "mvp.png", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
import Pow | ||
import MessageUI | ||
import SwiftUI | ||
|
||
struct ExampleList: View { | ||
var body: some View { | ||
List { | ||
Section { | ||
VStack(alignment: .leading, spacing: 12) { | ||
Text("This is the official example app for Pow, the Surprise and Delight framework for SwiftUI.") | ||
|
||
Text("Tap the individual examples to see the effects and transitions in action.") | ||
|
||
Text("**Note:** While this app requires iOS 16, Pow itself supports iOS 15 and above.") | ||
} | ||
.font(.subheadline.leading(.loose)) | ||
.foregroundColor(.primary) | ||
|
||
Link(destination: URL(string: "https://movingparts.io/pow")!) { | ||
ViewThatFits { | ||
Label("Pow Website", systemImage: "safari") | ||
Label("Pow Website", systemImage: "safari") | ||
Label("Pow Website", systemImage: "safari") | ||
Label("Pow Website", systemImage: "safari") | ||
} | ||
} | ||
|
||
Link(destination: URL(string: "https://github.com/movingparts-io/Pow-Examples")!) { | ||
ViewThatFits { | ||
Label("GitHub Repository for this App", systemImage: "terminal") | ||
Label("GitHub Repo for this App", systemImage: "terminal") | ||
Label("Repo for this App", systemImage: "terminal") | ||
} | ||
} | ||
|
||
if MFMailComposeViewController.canSendMail() { | ||
Link(destination: URL(string: "mailto:[email protected]")!) { | ||
Label("Support", systemImage: "envelope") | ||
} | ||
} | ||
} | ||
|
||
Section { | ||
SocialFeedExample.navigationLink | ||
CheckoutExample.navigationLink | ||
} header: { | ||
Label("Screens", systemImage: "iphone") | ||
} footer: { | ||
Text("Pre-composed screens that show how to use Pow in context. Use them as inspiration for your app.") | ||
} | ||
|
||
Section { | ||
PushDownExample.navigationLink | ||
RepeatExample.navigationLink | ||
SmokeExample.navigationLink | ||
} header: { | ||
Label("Conditional Effects", systemImage: "checklist") | ||
} footer: { | ||
Text("Conditional Effects are triggered continously, as long as a condition is met.") | ||
} | ||
|
||
Section { | ||
GlowExample.navigationLink | ||
PulseExample.navigationLink | ||
JumpExample.navigationLink | ||
PingExample.navigationLink | ||
RiseExample.navigationLink | ||
ShakeExample.navigationLink | ||
ShineExample.navigationLink | ||
SoundEffectExample.navigationLink | ||
SpinExample.navigationLink | ||
SprayExample.navigationLink | ||
} header: { | ||
Label("Change Effects", systemImage: "sparkles") | ||
} footer: { | ||
Text("Change Effects can be triggered whenever a value changes.") | ||
} | ||
|
||
Section { | ||
Group { | ||
AnvilExample.navigationLink | ||
BlindsExample.navigationLink | ||
BlurExample.navigationLink | ||
BoingExample.navigationLink | ||
ClockExample.navigationLink | ||
FilmExposureExample.navigationLink | ||
FlickerExample.navigationLink | ||
FlipExample.navigationLink | ||
GlareExample.navigationLink | ||
} | ||
Group { | ||
IrisExample.navigationLink | ||
MoveExample.navigationLink | ||
PoofExample.navigationLink | ||
PopExample.navigationLink | ||
SkidExample.navigationLink | ||
SnapshotExample.navigationLink | ||
SwooshExample.navigationLink | ||
VanishExample.navigationLink | ||
WipeExample.navigationLink | ||
} | ||
} header: { | ||
Label("Transitions", systemImage: "arrow.forward.square") | ||
} footer: { | ||
Text("Transitions use the existing SwiftUI `.transition(_:)` API.") | ||
} | ||
} | ||
.navigationTitle("Pow Examples") | ||
} | ||
} | ||
|
||
struct PresentInfoAction { | ||
var action: (any Example.Type) -> () | ||
|
||
init(action: @escaping (any Example.Type) -> Void) { | ||
self.action = action | ||
} | ||
|
||
func callAsFunction<T: Example>(_ type: T.Type) { | ||
action(type) | ||
} | ||
} | ||
|
||
extension EnvironmentValues { | ||
struct PresentInfoActionKey: EnvironmentKey { | ||
static var defaultValue: PresentInfoAction? = nil | ||
} | ||
|
||
var presentInfoAction: PresentInfoAction? { | ||
get { self[PresentInfoActionKey.self] } | ||
set { self[PresentInfoActionKey.self] = newValue } | ||
} | ||
} | ||
|
||
struct InfoButton<T: Example>: View { | ||
var type: T.Type | ||
|
||
@Environment(\.presentInfoAction) | ||
var presentInfoAction | ||
|
||
var body: some View { | ||
if let presentInfoAction { | ||
Button { | ||
presentInfoAction(type) | ||
} label: { | ||
Label("About", systemImage: "info.circle") | ||
} | ||
} | ||
} | ||
} | ||
|
||
struct ExampleList_Previews: PreviewProvider { | ||
static var previews: some View { | ||
NavigationStack { | ||
ExampleList() | ||
} | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
Example/Pow Example/Examples/Change Effects/GlowExample.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import Pow | ||
import SwiftUI | ||
|
||
struct GlowExample: View, Example { | ||
@State | ||
var changes: Int = 0 | ||
|
||
var body: some View { | ||
VStack { | ||
// GroupBox { | ||
// LabeledContent("Drawing Mode") { | ||
// Picker("Drawing Mode", selection: $drawingMode) { | ||
// Text("Fill").tag(AnyChangeEffect.PulseDrawingMode.fill) | ||
// Text("Stroke").tag(AnyChangeEffect.PulseDrawingMode.stroke) | ||
// } | ||
// } | ||
// } | ||
// .padding(.horizontal) | ||
|
||
Spacer() | ||
|
||
ZStack { | ||
PlaceholderView() | ||
.overlay(alignment: .badgeAlignment) { | ||
let shape = Capsule() | ||
|
||
Text(changes.formatted()) | ||
.font(.body.bold().monospacedDigit()) | ||
.foregroundColor(.white) | ||
.padding(.vertical, 8) | ||
.padding(.horizontal, 16) | ||
.background { | ||
shape.fill(.pink) | ||
.changeEffect(.glow(color: .pink, radius: 20), value: changes) | ||
} | ||
.alignmentGuide(HorizontalAlignment.badgeAlignment) { d in | ||
d[HorizontalAlignment.center] | ||
} | ||
.alignmentGuide(VerticalAlignment.badgeAlignment) { d in | ||
d[VerticalAlignment.center] | ||
} | ||
.allowsHitTesting(false) | ||
} | ||
} | ||
|
||
Spacer() | ||
} | ||
.defaultBackground() | ||
.onTapGesture { | ||
changes += 1 | ||
} | ||
} | ||
|
||
static var description: some View { | ||
Text(""" | ||
Makes the view glow whenever a value changes | ||
- Parameters: | ||
- `color`: The color to use. | ||
- `radius`: The radius of the glow. | ||
""") | ||
} | ||
|
||
static let localPath = LocalPath() | ||
|
||
static var icon: Image? { | ||
Image(systemName: "dot.radiowaves.left.and.right") | ||
} | ||
|
||
static var newIn0_3_0: Bool { true } | ||
} |
Oops, something went wrong.