Skip to content

Commit

Permalink
Moving Pow to @EmergeTools
Browse files Browse the repository at this point in the history
Co-authored-by: Robert Böhnke <robb@robb.is>
Co-authored-by: Kasper Lahti <kasper@lahti.email>
  • Loading branch information
3 people committed Nov 29, 2023
1 parent d5dc837 commit 781d455
Show file tree
Hide file tree
Showing 206 changed files with 13,604 additions and 195 deletions.
61 changes: 61 additions & 0 deletions 0.x.x to 1.0.0 Update Guide/README.md
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.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
790 changes: 790 additions & 0 deletions Example/Pow Example.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions Example/Pow Example/Assets.xcassets/Contents.json
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 Example/Pow Example/Assets.xcassets/disco.imageset/Contents.json
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
}
}
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 Example/Pow Example/Assets.xcassets/mvp.imageset/Contents.json
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
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
158 changes: 158 additions & 0 deletions Example/Pow Example/ExampleList.swift
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:hello@movingparts.io")!) {
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 Example/Pow Example/Examples/Change Effects/GlowExample.swift
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 }
}

0 comments on commit 781d455

Please sign in to comment.