-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Yanis Plumit
committed
Nov 11, 2022
1 parent
0184afc
commit e0b1f8d
Showing
18 changed files
with
881 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
Examples/Examples.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
Examples/Examples.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> |
14 changes: 14 additions & 0 deletions
14
Examples/Examples.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
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 @@ | ||
{ | ||
"pins" : [ | ||
{ | ||
"identity" : "zpopuppresenter", | ||
"kind" : "remoteSourceControl", | ||
"location" : "https://github.com/Jnis/ZPopupPresenter.git", | ||
"state" : { | ||
"branch" : "main", | ||
"revision" : "0184afcf9d40cd71a082bc53b4d58258db1d3e73" | ||
} | ||
} | ||
], | ||
"version" : 2 | ||
} |
11 changes: 11 additions & 0 deletions
11
Examples/Examples/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 | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
Examples/Examples/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,63 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"platform" : "ios", | ||
"size" : "1024x1024" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "1x", | ||
"size" : "16x16" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "2x", | ||
"size" : "16x16" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "1x", | ||
"size" : "32x32" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "2x", | ||
"size" : "32x32" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "1x", | ||
"size" : "128x128" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "2x", | ||
"size" : "128x128" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "1x", | ||
"size" : "256x256" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "2x", | ||
"size" : "256x256" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "1x", | ||
"size" : "512x512" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "2x", | ||
"size" : "512x512" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
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 | ||
} | ||
} |
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
Examples/Examples/Assets.xcassets/pig.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" : " pig.jpg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
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,37 @@ | ||
// | ||
// ContentView.swift | ||
// Examples | ||
// | ||
// Created by Yanis Plumit on 11.11.2022. | ||
// | ||
|
||
import SwiftUI | ||
import ZPopupPresenter | ||
|
||
|
||
struct ContentView: View { | ||
let zPopupPresenterModel = ZPopupPresenterModel() // 1. model | ||
|
||
var body: some View { | ||
ZStack { | ||
NavigationView { | ||
TabView { | ||
MenuView() | ||
.tabItem { | ||
Label("Menu", systemImage: "list.dash") | ||
} | ||
.environmentObject(zPopupPresenterModel) // 2. inject model for subviews | ||
// | ||
} | ||
} | ||
|
||
ZPopupPresenterView(model: zPopupPresenterModel) // 3. popups place | ||
} | ||
} | ||
} | ||
|
||
struct ContentView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
ContentView() | ||
} | ||
} |
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,76 @@ | ||
// | ||
// Demo1View.swift | ||
// Examples | ||
// | ||
// Created by Yanis Plumit on 11.11.2022. | ||
// | ||
|
||
import SwiftUI | ||
import ZPopupPresenter | ||
|
||
struct Demo1View: View { | ||
@EnvironmentObject var zPopupPresenterModel: ZPopupPresenterModel | ||
|
||
let buttonsOffset: CGFloat | ||
let close: () -> Void | ||
|
||
var body: some View { | ||
VStack { | ||
Spacer().frame(height: buttonsOffset) | ||
|
||
HStack { | ||
showPopupWithAnimationButton | ||
|
||
Button(action: { | ||
close() | ||
}, label: { | ||
HStack { | ||
Spacer() | ||
Text("Close popup") | ||
.padding() | ||
.foregroundColor(.blue) | ||
.background(Capsule().foregroundColor(.yellow)) | ||
Spacer() | ||
} | ||
}) | ||
} | ||
|
||
Spacer() | ||
} | ||
.background(Color.gray.opacity(0.8)) | ||
} | ||
|
||
var showPopupWithAnimationButton: some View { | ||
Button(action: { | ||
withAnimation { | ||
zPopupPresenterModel.showPopup({ close in | ||
AnyView( | ||
Demo1View(buttonsOffset: buttonsOffset + 50, close: { | ||
withAnimation { | ||
close() | ||
} | ||
}) | ||
.environmentObject(zPopupPresenterModel) | ||
.transition(.slide) | ||
) | ||
}) | ||
} | ||
}, label: { | ||
HStack { | ||
Spacer() | ||
Text("With Animation") | ||
.padding() | ||
.foregroundColor(.blue) | ||
.background(Capsule().foregroundColor(.white)) | ||
Spacer() | ||
} | ||
}) | ||
} | ||
|
||
} | ||
|
||
struct Demo1View_Previews: PreviewProvider { | ||
static var previews: some View { | ||
Demo1View(buttonsOffset: 0, close: {}) | ||
} | ||
} |
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,79 @@ | ||
// | ||
// Demo2DetaisView.swift | ||
// Examples | ||
// | ||
// Created by Yanis Plumit on 11.11.2022. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct Demo2DetailsView: View { | ||
enum AnimationIDs { | ||
static let image = "image" | ||
static let title = "title" | ||
static let bg = "bg" | ||
} | ||
|
||
var namespace: Namespace.ID | ||
let close: () -> Void | ||
|
||
var body: some View { | ||
ZStack { | ||
ScrollView { | ||
VStack { | ||
Image("pig") | ||
.resizable() | ||
.scaledToFit() | ||
.matchedGeometryEffect(id: Demo2DetailsView.AnimationIDs.image, in: namespace) | ||
|
||
HStack { | ||
Text("Run Pig Run!") | ||
.font(.title) | ||
.padding(.bottom, 16) | ||
.matchedGeometryEffect(id: Demo2DetailsView.AnimationIDs.title, in: namespace, properties: .position) | ||
Spacer() | ||
}.padding() | ||
|
||
HStack { | ||
Text(description) | ||
.padding(.bottom, 16) | ||
Spacer() | ||
}.padding() | ||
} | ||
} | ||
|
||
VStack { | ||
HStack { | ||
Spacer() | ||
Button(action: { | ||
close() | ||
}, label: { | ||
Text("Close popup") | ||
.padding() | ||
.foregroundColor(.blue) | ||
.background(Capsule().foregroundColor(.yellow)) | ||
}) | ||
} | ||
Spacer() | ||
} | ||
} | ||
.background(.white) | ||
.matchedGeometryEffect(id: Demo2DetailsView.AnimationIDs.bg, in: namespace) | ||
} | ||
|
||
let description = """ | ||
The piggy escaped from cage and he are waiting your help! | ||
Only you can help out the little pig to escape slaughterhouse, where prepare amazing pork. And we don't promise you, that it will be easy, but it will be interesting and exciting!! | ||
The success of the little piggy only in your hands. | ||
""" | ||
} | ||
|
||
struct Demo2DetailsView_Previews: PreviewProvider { | ||
@Namespace static var namespace | ||
|
||
static var previews: some View { | ||
Demo2DetailsView(namespace: namespace, close: {}) | ||
} | ||
} |
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,58 @@ | ||
// | ||
// Demo2ItemView.swift | ||
// Examples | ||
// | ||
// Created by Yanis Plumit on 11.11.2022. | ||
// | ||
|
||
import SwiftUI | ||
import ZPopupPresenter | ||
|
||
struct Demo2ItemView: View { | ||
@Namespace var namespace | ||
@EnvironmentObject var zPopupPresenterModel: ZPopupPresenterModel | ||
|
||
var body: some View { | ||
VStack { | ||
Image("pig") | ||
.resizable() | ||
.scaledToFit() | ||
.padding(.top, 20) | ||
.matchedGeometryEffect(id: Demo2DetailsView.AnimationIDs.image, in: namespace) | ||
|
||
Text("Run Pig Run!") | ||
.font(.title) | ||
.padding(.bottom, 16) | ||
.matchedGeometryEffect(id: Demo2DetailsView.AnimationIDs.title, in: namespace, properties: .position) | ||
} | ||
.background(Color.white.cornerRadius(20)) | ||
.onTapGesture { | ||
withAnimation(.spring()) { | ||
zPopupPresenterModel.showPopup({ close in | ||
AnyView( | ||
Demo2DetailsView(namespace: namespace, close: { | ||
withAnimation(.spring()) { | ||
close() | ||
} | ||
}) | ||
) | ||
}) | ||
} | ||
} | ||
.overlay(content: { | ||
Color.clear | ||
.matchedGeometryEffect(id: Demo2DetailsView.AnimationIDs.bg, in: namespace) | ||
}) | ||
} | ||
} | ||
|
||
struct Demo2ItemView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
VStack { | ||
Spacer() | ||
Demo2ItemView() | ||
Spacer() | ||
} | ||
.background(.black) | ||
} | ||
} |
Oops, something went wrong.