Skip to content

Commit

Permalink
Clean up, fix small things and bump minimal version to iOS 16
Browse files Browse the repository at this point in the history
  • Loading branch information
damikdk committed Aug 3, 2022
1 parent e73684a commit c8d10b3
Show file tree
Hide file tree
Showing 15 changed files with 49 additions and 90 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# SwiftUI-Games (WIP)
Collection of simple demos of SwiftUI + SceneKit games

[TestFlight Beta](https://testflight.apple.com/join/52wVoy8Z "TestFlight Beta")
[TestFlight Beta](https://testflight.apple.com/join/52wVoy8Z "TestFlight Beta") (iOS 16+)

### Design
- Pure `SwiftUI` at any cost. Zero `UIKit` imports
- Full Apple-crossplatform. Playable on `iOS`, `macOS`. (`tvOS` later)
- Only modern APIs, zero legacy support. `iOS 15+` since day one
- Only modern APIs, zero legacy support. `iOS 16+`
- Zero dependencies
- Zero projectiles. I hate projectiles

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions Shared/Games/TBS/TBSGame.swift
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ extension TBSGame {
print("Strange, there is no current team. Or it's not in TeamManager array: \(currentTeam?.id ?? "<NIL>")")
currentTeam = teams.first
}

currentHero = nil
}

func highlight(team: Team?) {
Expand Down
19 changes: 7 additions & 12 deletions Shared/Games/TBS/TBSGameView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ struct TBSGameView: GameView {
@State var lastCameraOffset = SCNVector3()

var body: some View {
// We can't get touch location with TapGesture, so hack:
// (https://stackoverflow.com/a/56567649/7996650)
let tap = DragGesture(minimumDistance: 0, coordinateSpace: .global)

// Camera drag
let drag = DragGesture(coordinateSpace: .global)
.onChanged({ gesture in
if let camera = sceneRendererDelegate.renderer?.pointOfView {
let translation = gesture.translation
Expand All @@ -34,14 +34,6 @@ struct TBSGameView: GameView {
}
})
.onEnded { gesture in
let translation = gesture.translation

if abs(translation.height) < 20,
abs(translation.width) < 20 {

pick(atPoint: gesture.location)
}

lastCameraOffset = SCNVector3()
}

Expand All @@ -53,7 +45,10 @@ struct TBSGameView: GameView {
],
delegate: sceneRendererDelegate)
.ignoresSafeArea()
.gesture(tap)
.onTapGesture { location in
pick(atPoint: location)
}
.gesture(drag)

VStack {
// Top HUD
Expand Down
File renamed without changes.
10 changes: 10 additions & 0 deletions Shared/SwiftUI-Games (iOS).entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?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>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>
8 changes: 8 additions & 0 deletions Shared/SwiftUI-Games--iOS--Info.plist
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>LSApplicationCategoryType</key>
<string>public.app-category.games</string>
</dict>
</plist>
1 change: 1 addition & 0 deletions Shared/UI/Buttons/MaterialButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ struct MaterialButtonStyle: ButtonStyle {
.background(.ultraThinMaterial)
.cornerRadius(25)
.scaleEffect(configuration.isPressed ? 0.9 : 1)
.hoverEffect(.lift)
}
}
17 changes: 0 additions & 17 deletions Shared/UI/Buttons/ScaleButtonStyle.swift

This file was deleted.

1 change: 0 additions & 1 deletion Shared/UI/Menu/CardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,5 @@ struct CardView: View {
.cornerRadius(20)
.frame(minHeight: 200, maxHeight: 300)
}
.buttonStyle(ScaleButtonStyle())
}
}
39 changes: 0 additions & 39 deletions Shared/UI/View+Extenstions.swift

This file was deleted.

38 changes: 19 additions & 19 deletions SwiftUI-Games.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

/* Begin PBXBuildFile section */
13CA797126D53E450052FE5D /* SuperController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13CA797026D53E450052FE5D /* SuperController.swift */; };
971D8B41267D495B00F0A193 /* View+Extenstions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 971D8B40267D495B00F0A193 /* View+Extenstions.swift */; };
9727F47C26966D54006C7911 /* ContactDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9727F47B26966D54006C7911 /* ContactDelegate.swift */; };
9728694C2688FD5B00FF1BB1 /* TogetherGame.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9728694B2688FD5B00FF1BB1 /* TogetherGame.swift */; };
9728694E2688FEFD00FF1BB1 /* TogetherGameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9728694D2688FEFD00FF1BB1 /* TogetherGameView.swift */; };
Expand All @@ -27,7 +26,6 @@
97CACB1A267AAE5D00A13A02 /* MinimalDemo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97CACB19267AAE5D00A13A02 /* MinimalDemo.swift */; };
97CACB1C267AAF3500A13A02 /* MinimalDemoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97CACB1B267AAF3500A13A02 /* MinimalDemoView.swift */; };
ED63086D2670C91C003FD347 /* MaterialButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED63086C2670C91C003FD347 /* MaterialButtonStyle.swift */; };
ED63086F2670CB73003FD347 /* ScaleButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED63086E2670CB73003FD347 /* ScaleButtonStyle.swift */; };
EDD3DBCC26700EF1001E7373 /* SCNVector3+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDD3DBCB26700EF1001E7373 /* SCNVector3+Extensions.swift */; };
EDD3DBCE26701B97001E7373 /* Hitscan.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDD3DBCD26701B97001E7373 /* Hitscan.swift */; };
EDE3A154266F803A00362308 /* SwiftUIGamesApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDE3A146266F803900362308 /* SwiftUIGamesApp.swift */; };
Expand All @@ -46,7 +44,6 @@
/* Begin PBXFileReference section */
13CA797026D53E450052FE5D /* SuperController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SuperController.swift; sourceTree = "<group>"; };
13CA797226D569F80052FE5D /* SwiftUI-Games--iOS--Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = "SwiftUI-Games--iOS--Info.plist"; sourceTree = "<group>"; };
971D8B40267D495B00F0A193 /* View+Extenstions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+Extenstions.swift"; sourceTree = "<group>"; };
9727F47B26966D54006C7911 /* ContactDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactDelegate.swift; sourceTree = "<group>"; };
9728694B2688FD5B00FF1BB1 /* TogetherGame.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TogetherGame.swift; sourceTree = "<group>"; };
9728694D2688FEFD00FF1BB1 /* TogetherGameView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TogetherGameView.swift; sourceTree = "<group>"; };
Expand All @@ -66,7 +63,6 @@
97CACB19267AAE5D00A13A02 /* MinimalDemo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MinimalDemo.swift; sourceTree = "<group>"; };
97CACB1B267AAF3500A13A02 /* MinimalDemoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MinimalDemoView.swift; sourceTree = "<group>"; };
ED63086C2670C91C003FD347 /* MaterialButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MaterialButtonStyle.swift; sourceTree = "<group>"; };
ED63086E2670CB73003FD347 /* ScaleButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScaleButtonStyle.swift; sourceTree = "<group>"; };
EDD3DBCB26700EF1001E7373 /* SCNVector3+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SCNVector3+Extensions.swift"; sourceTree = "<group>"; };
EDD3DBCD26701B97001E7373 /* Hitscan.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Hitscan.swift; sourceTree = "<group>"; };
EDE3A146266F803900362308 /* SwiftUIGamesApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftUIGamesApp.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -94,6 +90,16 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
1363DFD4289B21F30008971F /* Logic */ = {
isa = PBXGroup;
children = (
97BDFA402683EDC70016CE77 /* Team.swift */,
978C102C267383A000E23D85 /* Ability.swift */,
EDD3DBCD26701B97001E7373 /* Hitscan.swift */,
);
path = Logic;
sourceTree = "<group>";
};
13CA796F26D53E1F0052FE5D /* Control */ = {
isa = PBXGroup;
children = (
Expand All @@ -114,6 +120,7 @@
978C102926737CB100E23D85 /* Entities */ = {
isa = PBXGroup;
children = (
EDE3A16E266F83E300362308 /* MaterialNode.swift */,
978C102726737CA100E23D85 /* Entity.swift */,
978C102E2673846800E23D85 /* Shield.swift */,
978C102A26737E3B00E23D85 /* Hero.swift */,
Expand Down Expand Up @@ -154,7 +161,6 @@
children = (
EDE3A162266F83E300362308 /* Menu */,
EDC4F3B32670FAFA0048E885 /* Buttons */,
971D8B40267D495B00F0A193 /* View+Extenstions.swift */,
);
path = UI;
sourceTree = "<group>";
Expand All @@ -163,18 +169,17 @@
isa = PBXGroup;
children = (
ED63086C2670C91C003FD347 /* MaterialButtonStyle.swift */,
ED63086E2670CB73003FD347 /* ScaleButtonStyle.swift */,
);
path = Buttons;
sourceTree = "<group>";
};
EDE3A140266F803800362308 = {
isa = PBXGroup;
children = (
13CA797226D569F80052FE5D /* SwiftUI-Games--iOS--Info.plist */,
9777F67826D25FA600A0F986 /* SwiftUI-Games (iOS).entitlements */,
EDE3A145266F803900362308 /* Shared */,
975D4DA0267FBEB0007CC8A0 /* README.md */,
13CA797226D569F80052FE5D /* SwiftUI-Games--iOS--Info.plist */,
9777F67826D25FA600A0F986 /* SwiftUI-Games (iOS).entitlements */,
EDE3A14E266F803A00362308 /* Products */,
);
sourceTree = "<group>";
Expand Down Expand Up @@ -215,7 +220,6 @@
13CA796F26D53E1F0052FE5D /* Control */,
EDE3A166266F83E300362308 /* Themes.swift */,
EDE3A168266F83E300362308 /* Samples.swift */,
975D4D9E267F98C4007CC8A0 /* LightHelpers.swift */,
);
path = Helpers;
sourceTree = "<group>";
Expand All @@ -229,10 +233,7 @@
9728694A2688FD3200FF1BB1 /* Together */,
97CACB13267A8D6D00A13A02 /* Game.swift */,
97CACB16267A905500A13A02 /* GameView.swift */,
EDE3A16E266F83E300362308 /* MaterialNode.swift */,
97BDFA402683EDC70016CE77 /* Team.swift */,
978C102C267383A000E23D85 /* Ability.swift */,
EDD3DBCD26701B97001E7373 /* Hitscan.swift */,
1363DFD4289B21F30008971F /* Logic */,
978C102926737CB100E23D85 /* Entities */,
);
path = Games;
Expand All @@ -245,6 +246,7 @@
EDD3DBCB26700EF1001E7373 /* SCNVector3+Extensions.swift */,
978C1025267379B100E23D85 /* SceneRendererDelegate.swift */,
9727F47B26966D54006C7911 /* ContactDelegate.swift */,
975D4D9E267F98C4007CC8A0 /* LightHelpers.swift */,
);
path = Scene;
sourceTree = "<group>";
Expand Down Expand Up @@ -323,7 +325,6 @@
978C102B26737E3B00E23D85 /* Hero.swift in Sources */,
978C102F2673846800E23D85 /* Shield.swift in Sources */,
EDE3A176266F83E300362308 /* Field.swift in Sources */,
971D8B41267D495B00F0A193 /* View+Extenstions.swift in Sources */,
ED63086D2670C91C003FD347 /* MaterialButtonStyle.swift in Sources */,
979AA3ED26C1C2240014BBD6 /* DarkGameView.swift in Sources */,
9727F47C26966D54006C7911 /* ContactDelegate.swift in Sources */,
Expand All @@ -344,7 +345,6 @@
EDE3A171266F83E300362308 /* Themes.swift in Sources */,
975D4D9F267F98C4007CC8A0 /* LightHelpers.swift in Sources */,
EDE3A174266F83E300362308 /* TBSGameView.swift in Sources */,
ED63086F2670CB73003FD347 /* ScaleButtonStyle.swift in Sources */,
EDE3A154266F803A00362308 /* SwiftUIGamesApp.swift in Sources */,
9728694C2688FD5B00FF1BB1 /* TogetherGame.swift in Sources */,
97CACB1A267AAE5D00A13A02 /* MinimalDemo.swift in Sources */,
Expand Down Expand Up @@ -409,7 +409,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -465,7 +465,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SWIFT_COMPILATION_MODE = wholemodule;
Expand Down Expand Up @@ -497,7 +497,7 @@
INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeRight UIInterfaceOrientationLandscapeLeft";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -536,7 +536,7 @@
INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeRight UIInterfaceOrientationLandscapeLeft";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down

0 comments on commit c8d10b3

Please sign in to comment.