Skip to content

Commit

Permalink
Merge pull request #54 from dscyrescotti/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
dscyrescotti authored Dec 25, 2022
2 parents e3c2cb0 + 543f9f5 commit c104540
Show file tree
Hide file tree
Showing 1,701 changed files with 3,632 additions and 868 deletions.
Binary file added Assets/Previews/ShuffleDeck-Preview.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/ShuffleDeck-Demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions Demo/Demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
EC7410B928C44DA3005EFC41 /* MainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC7410B828C44DA3005EFC41 /* MainView.swift */; };
EC7410BD28C45605005EFC41 /* TimingShuffleStackDemoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC7410BC28C45605005EFC41 /* TimingShuffleStackDemoView.swift */; };
EC98DC2128C8E1E7000F3DD9 /* ShuffleIt in Frameworks */ = {isa = PBXBuildFile; productRef = EC98DC2028C8E1E7000F3DD9 /* ShuffleIt */; };
ECBE0E4B294D782E002239C1 /* ShuffleDeckDemoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBE0E4A294D782E002239C1 /* ShuffleDeckDemoView.swift */; };
ECDE4B4829584BC800FF1876 /* LandmarkCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECDE4B4729584BC800FF1876 /* LandmarkCard.swift */; };
ECDE4B4A295859A700FF1876 /* Landmarks.json in Resources */ = {isa = PBXBuildFile; fileRef = ECDE4B49295859A700FF1876 /* Landmarks.json */; };
ECDE4B4C295859D300FF1876 /* Landmark.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECDE4B4B295859D300FF1876 /* Landmark.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -39,6 +43,10 @@
EC7410B828C44DA3005EFC41 /* MainView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainView.swift; sourceTree = "<group>"; };
EC7410BC28C45605005EFC41 /* TimingShuffleStackDemoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimingShuffleStackDemoView.swift; sourceTree = "<group>"; };
EC98DC1F28C8E1D6000F3DD9 /* ShuffleIt */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = ShuffleIt; path = ..; sourceTree = "<group>"; };
ECBE0E4A294D782E002239C1 /* ShuffleDeckDemoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShuffleDeckDemoView.swift; sourceTree = "<group>"; };
ECDE4B4729584BC800FF1876 /* LandmarkCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LandmarkCard.swift; sourceTree = "<group>"; };
ECDE4B49295859A700FF1876 /* Landmarks.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = Landmarks.json; sourceTree = "<group>"; };
ECDE4B4B295859D300FF1876 /* Landmark.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Landmark.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -83,6 +91,7 @@
EC1D2D6428C367E00000668C /* Json */ = {
isa = PBXGroup;
children = (
ECDE4B49295859A700FF1876 /* Landmarks.json */,
EC1D2D6A28C37D280000668C /* Sneakers.json */,
);
path = Json;
Expand All @@ -93,6 +102,7 @@
children = (
EC467D8128D6CF4800291DFD /* SneakerCard.swift */,
EC1D2D7528C3A6EF0000668C /* SneakerItemRow.swift */,
ECDE4B4729584BC800FF1876 /* LandmarkCard.swift */,
);
path = Components;
sourceTree = "<group>";
Expand All @@ -109,6 +119,7 @@
isa = PBXGroup;
children = (
EC1D2D7028C3882D0000668C /* Sneaker.swift */,
ECDE4B4B295859D300FF1876 /* Landmark.swift */,
);
path = Models;
sourceTree = "<group>";
Expand Down Expand Up @@ -140,6 +151,7 @@
EC467D8328D6CF8C00291DFD /* Demos */ = {
isa = PBXGroup;
children = (
ECBE0E49294D7659002239C1 /* ShuffleDeck */,
EC467D7D28D6CC5200291DFD /* CarouselStack */,
EC1D2D5F28C366A10000668C /* ShuffleStack */,
);
Expand Down Expand Up @@ -195,6 +207,22 @@
name = Packages;
sourceTree = "<group>";
};
ECBE0E49294D7659002239C1 /* ShuffleDeck */ = {
isa = PBXGroup;
children = (
ECBE0E4C294D789A002239C1 /* Scenes */,
);
path = ShuffleDeck;
sourceTree = "<group>";
};
ECBE0E4C294D789A002239C1 /* Scenes */ = {
isa = PBXGroup;
children = (
ECBE0E4A294D782E002239C1 /* ShuffleDeckDemoView.swift */,
);
path = Scenes;
sourceTree = "<group>";
};
ECF6A7AA28BE6C360098E2BA /* Frameworks */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -268,6 +296,7 @@
EC64DECA28C4EB4000C317A3 /* Launch Screen.storyboard in Resources */,
EC1D2D6B28C37D280000668C /* Sneakers.json in Resources */,
EC67A96128BE69F800BDAB83 /* Assets.xcassets in Resources */,
ECDE4B4A295859A700FF1876 /* Landmarks.json in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -278,14 +307,17 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
ECDE4B4C295859D300FF1876 /* Landmark.swift in Sources */,
EC1D2D7128C3882D0000668C /* Sneaker.swift in Sources */,
EC467D8228D6CF4800291DFD /* SneakerCard.swift in Sources */,
EC7410B928C44DA3005EFC41 /* MainView.swift in Sources */,
EC1D2D7D28C3C8B50000668C /* DragGestureViewModifier.swift in Sources */,
EC7410BD28C45605005EFC41 /* TimingShuffleStackDemoView.swift in Sources */,
ECDE4B4829584BC800FF1876 /* LandmarkCard.swift in Sources */,
EC467D8028D6CCC700291DFD /* CarouselStackDemoView.swift in Sources */,
EC1D2D7628C3A6EF0000668C /* SneakerItemRow.swift in Sources */,
EC1D2D6E28C382EF0000668C /* Color+Extension.swift in Sources */,
ECBE0E4B294D782E002239C1 /* ShuffleDeckDemoView.swift in Sources */,
EC1D2D6328C366F80000668C /* ShuffleStackDemoView.swift in Sources */,
EC67A95D28BE69F800BDAB83 /* DemoApp.swift in Sources */,
);
Expand Down
11 changes: 11 additions & 0 deletions Demo/Demo/App/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ struct MainView: View {
}) {
Label("CarouselStack", systemImage: "sparkles.rectangle.stack.fill")
}
#if os(iOS)
Button(action: {
route = .shuffleDeck
}) {
Label("ShuffleDeck", systemImage: "photo.on.rectangle.angled")
}
#endif
} header: {
Text("ShuffleStack")
}
Expand All @@ -37,6 +44,8 @@ struct MainView: View {
TimingShuffleStackDemoView()
case .carouselStack:
CarouselStackDemoView()
case .shuffleDeck:
ShuffleDeckDemoView()
}
}
}
Expand All @@ -53,12 +62,14 @@ enum Route: Identifiable {
case shuffleStack
case timingShuffleStack
case carouselStack
case shuffleDeck

var id: String {
switch self {
case .shuffleStack: return "shuffle-stack"
case .timingShuffleStack: return "timing-shuffle-stack"
case .carouselStack: return "carousel-stack"
case .shuffleDeck: return "shuffle-deck"
}
}
}
48 changes: 48 additions & 0 deletions Demo/Demo/Components/LandmarkCard.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import SwiftUI

struct LandmarkCard: View {
let landmark: Landmark

var body: some View {
ZStack(alignment: .bottomLeading) {
Image(landmark.image)
.resizable()
LinearGradient(
colors: [
.clear,
.clear,
.black.opacity(0.7)
],
startPoint: .top,
endPoint: .bottom
)
VStack(alignment: .leading) {
Text(landmark.name)
.font(.title.bold())
Text(landmark.location)
.font(.title3.bold())
}
.foregroundColor(.white)
.padding()
}
.frame(width: 300, height: 400)
.cornerRadius(20)
.shadow(radius: 10)
}
}

struct LandmarkCard_Previews: PreviewProvider {
static var previews: some View {
LandmarkCard(
landmark: Landmark(
id: "shwedagon_pagoda",
image: "shwedagon_pagoda",
name: "Shwedagon Pagoda",
location: "Yangon, Myanmar",
lat: 0,
long: 0,
background: ""
)
)
}
}
76 changes: 76 additions & 0 deletions Demo/Demo/Demos/ShuffleDeck/Scenes/ShuffleDeckDemoView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import SwiftUI
import Combine
import ShuffleIt
import MapKit

struct ShuffleDeckDemoView: View {
@Environment(\.dismiss) var dismiss
@State private var landmark: Landmark?

let landmarks: [Landmark] = .landmarks()

var body: some View {
VStack(alignment: .leading, spacing: 0) {
VStack(alignment: .leading) {
Text("Captivating Landmarks")
.font(.title.bold())
Text("For Your Next Adventure")
.font(.title2.bold())
}
.padding()
Spacer()
ShuffleDeck(
landmarks,
initialIndex: 0
) { landmark in
LandmarkCard(landmark: landmark)
}
.shuffleDeckAnimation(.easeInOut)
.shuffleDeckScale(0.5)
.onShuffleDeck { context in
landmark = landmarks[context.index]
}
.padding(.vertical)
Spacer()
Spacer()
}
.overlay(alignment: .topTrailing) {
Button(action: {
dismiss()
}) {
Image(systemName: "xmark.circle.fill")
.font(.largeTitle)
.foregroundStyle(.white)
.background {
Circle()
.foregroundColor(.black.opacity(0.4))
.padding(4)
}
}
.buttonStyle(.plain)
.padding([.top, .horizontal])
}
.background {
if let landmark = landmark {
GeometryReader { proxy in
ZStack {
Circle()
.scale(1.1, anchor: .bottomTrailing)
.position(x: proxy.size.width, y: proxy.size.height / 2.5)
.foregroundColor(Color(hex: landmark.background).opacity(0.3))
Circle()
.scale(0.7, anchor: .bottomTrailing)
.position(x: 0, y: proxy.size.height / 1.5)
.foregroundColor(Color(hex: landmark.background).opacity(0.2))
}
.blur(radius: 40)
.background(.white)
.ignoresSafeArea()
}
}
}
.onAppear {
landmark = landmarks.first
}
}
}
23 changes: 23 additions & 0 deletions Demo/Demo/Models/Landmark.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import MapKit
import Foundation

struct Landmark: Decodable, Identifiable {
let id: String
let image: String
let name: String
let location: String
let lat: Double
let long: Double
let background: String

var coordinate: CLLocationCoordinate2D {
CLLocationCoordinate2D(latitude: lat, longitude: long)
}
}

extension Array where Element == Landmark {
static func landmarks() -> Self {
guard let path = Bundle.main.url(forResource: "Landmarks", withExtension: "json"), let data = try? Data(contentsOf: path), let landmarks = try? JSONDecoder().decode([Landmark].self, from: data) else { return [] }
return landmarks
}
}
6 changes: 6 additions & 0 deletions Demo/Demo/Resources/Assets.xcassets/landmarks/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "christ_the_redeemer.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "original"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "eiffel_tower.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "original"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "great_wall_of_china.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "original"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "merlion_statue.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "original"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "niagara_falls.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "original"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "petronas_towers.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "original"
}
}
Loading

0 comments on commit c104540

Please sign in to comment.