-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from vdshko/develop
Version 1.0
- Loading branch information
Showing
69 changed files
with
2,864 additions
and
0 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,62 @@ | ||
.DS_Store | ||
# Build generated | ||
build/ | ||
DerivedData/ | ||
Package.resolved | ||
|
||
# Various settings | ||
*.pbxuser | ||
!default.pbxuser | ||
*.mode1v3 | ||
!default.mode1v3 | ||
*.mode2v3 | ||
!default.mode2v3 | ||
*.perspectivev3 | ||
!default.perspectivev3 | ||
xcuserdata/ | ||
|
||
# Other | ||
*.moved-aside | ||
*.xcuserstate | ||
|
||
# Obj-C/Swift specific | ||
*.hmap | ||
*.ipa | ||
*.dSYM.zip | ||
*.dSYM | ||
|
||
# Playgrounds | ||
timeline.xctimeline | ||
playground.xcworkspace | ||
|
||
# CocoaPods | ||
Pods/ | ||
|
||
# Carthage | ||
Carthage/Build | ||
Carthage/Checkouts | ||
|
||
# development | ||
|
||
logs/* | ||
tmp/* | ||
|
||
# AppCode | ||
|
||
.idea/ | ||
|
||
# fastlane | ||
|
||
**/fastlane/report.xml | ||
**/fastlane/README.md | ||
**/fastlane/Preview.html | ||
**/fastlane/screenshots/**/*.png | ||
**/fastlane/test_output | ||
sonar-reports/* | ||
|
||
## GitLab CI | ||
|
||
.bundle/ | ||
vendor/ | ||
|
||
Brewfile.lock.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 |
---|---|---|
@@ -1,2 +1,7 @@ | ||
# TicTacToe | ||
TicTacToe game - written using SwiftUI in tandem with AppState-MVVM architecture. | ||
|
||
![Simulator Screen Shot - iPhone 13 Pro - 2022-07-17 at 02 16 05](https://user-images.githubusercontent.com/43936569/179374991-ae75f492-7650-4951-a96d-c9721fc07608.png) | ||
![Simulator Screen Shot - iPhone 13 Pro - 2022-07-17 at 02 17 08](https://user-images.githubusercontent.com/43936569/179374994-2648aaab-ac0d-4f12-bead-57f989227abb.png) | ||
![Simulator Screen Shot - iPhone 13 Pro - 2022-07-17 at 02 17 45](https://user-images.githubusercontent.com/43936569/179374995-721c4d92-48ff-4d31-a9aa-9ce16814b5d7.png) | ||
![Simulator Screen Shot - iPhone 13 Pro - 2022-07-17 at 02 17 52](https://user-images.githubusercontent.com/43936569/179374997-a018fb96-5dab-4630-97e1-ae1ff387c3fb.png) |
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,20 @@ | ||
platform :ios, '15.0' | ||
use_frameworks! | ||
|
||
install! 'cocoapods', :warn_for_unused_master_specs_repo => false | ||
|
||
target 'TicTacToe' do | ||
# swiftlint; https://github.com/realm/SwiftLint | ||
pod 'SwiftLint', '0.47.1', :inhibit_warnings => true | ||
|
||
# swiftgen; https://github.com/SwiftGen/SwiftGen | ||
pod 'SwiftGen', '6.5.1', :inhibit_warnings => true | ||
end | ||
|
||
post_install do |installer| | ||
installer.pods_project.targets.each do |target| | ||
target.build_configurations.each do |config| | ||
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.0' | ||
end | ||
end | ||
end |
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,20 @@ | ||
PODS: | ||
- SwiftGen (6.5.1) | ||
- SwiftLint (0.47.1) | ||
|
||
DEPENDENCIES: | ||
- SwiftGen (= 6.5.1) | ||
- SwiftLint (= 0.47.1) | ||
|
||
SPEC REPOS: | ||
trunk: | ||
- SwiftGen | ||
- SwiftLint | ||
|
||
SPEC CHECKSUMS: | ||
SwiftGen: a6d22010845f08fe18fbdf3a07a8e380fd22e0ea | ||
SwiftLint: f80f1be7fa96d30e0aa68e58d45d4ea1ccaac519 | ||
|
||
PODFILE CHECKSUM: 02dddcbd0b277315d4c485d5b5b7d944279ea87b | ||
|
||
COCOAPODS: 1.11.3 |
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
TicTacToe/TicTacToe.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
TicTacToe/TicTacToe.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> |
88 changes: 88 additions & 0 deletions
88
TicTacToe/TicTacToe.xcodeproj/xcshareddata/xcschemes/TicTacToe.xcscheme
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,88 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "1340" | ||
version = "1.3"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "A1E72F86284CD7AF00869321" | ||
BuildableName = "Tic Tac Toe.app" | ||
BlueprintName = "TicTacToe" | ||
ReferencedContainer = "container:TicTacToe.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES"> | ||
<Testables> | ||
<TestableReference | ||
skipped = "NO"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "A1E72F96284CD7B100869321" | ||
BuildableName = "TicTacToeTests.xctest" | ||
BlueprintName = "TicTacToeTests" | ||
ReferencedContainer = "container:TicTacToe.xcodeproj"> | ||
</BuildableReference> | ||
</TestableReference> | ||
</Testables> | ||
</TestAction> | ||
<LaunchAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
debugServiceExtension = "internal" | ||
allowLocationSimulation = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "A1E72F86284CD7AF00869321" | ||
BuildableName = "Tic Tac Toe.app" | ||
BlueprintName = "TicTacToe" | ||
ReferencedContainer = "container:TicTacToe.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
</LaunchAction> | ||
<ProfileAction | ||
buildConfiguration = "Release" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
debugDocumentVersioning = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "A1E72F86284CD7AF00869321" | ||
BuildableName = "Tic Tac Toe.app" | ||
BlueprintName = "TicTacToe" | ||
ReferencedContainer = "container:TicTacToe.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
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
TicTacToe/TicTacToe.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> |
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,33 @@ | ||
// | ||
// AppDelegate.swift | ||
// TicTacToe | ||
// | ||
// Created by Vlad Shkodich on 15.07.2022. | ||
// | ||
|
||
import UIKit | ||
import SwiftUI | ||
|
||
final class AppDelegate: NSObject, UIApplicationDelegate { | ||
|
||
static var orientationLock = UIInterfaceOrientationMask.portrait | ||
|
||
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { | ||
return AppDelegate.orientationLock | ||
} | ||
} | ||
|
||
extension View { | ||
|
||
func unlockRotation() -> some View { | ||
onAppear { | ||
AppDelegate.orientationLock = UIInterfaceOrientationMask.all | ||
UIViewController.attemptRotationToDeviceOrientation() | ||
} | ||
.onDisappear { | ||
AppDelegate.orientationLock = UIInterfaceOrientationMask.portrait | ||
UIDevice.current.setValue(UIInterfaceOrientation.portrait.rawValue, forKey: "orientation") | ||
UIViewController.attemptRotationToDeviceOrientation() | ||
} | ||
} | ||
} |
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,32 @@ | ||
// | ||
// TicTacToeApp.swift | ||
// TicTacToe | ||
// | ||
// Created by Vlad Shkodich on 05.06.2022. | ||
// | ||
|
||
import SwiftUI | ||
|
||
@main | ||
struct TicTacToeApp: App { | ||
|
||
@UIApplicationDelegateAdaptor var appDelegate: AppDelegate | ||
|
||
var body: some Scene { | ||
WindowGroup { | ||
MainView(viewModel: .init(diContainer: diContainer())) | ||
} | ||
} | ||
|
||
private func diContainer() -> DIContainer { | ||
let appState: AppState = AppState() | ||
let services: DIContainer.Services = DIContainer.Services( | ||
gameProgressService: GameProgressServiceImpl( | ||
appState: appState, | ||
aiEngine: AIEngineImpl() | ||
) | ||
) | ||
|
||
return DIContainer(appState: appState, services: services) | ||
} | ||
} |
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,16 @@ | ||
// | ||
// AppState.swift | ||
// TicTacToe | ||
// | ||
// Created by Vlad Shkodich on 05.06.2022. | ||
// | ||
|
||
import Combine | ||
|
||
final class AppState: ObservableObject { | ||
|
||
@Published var gameBoard: [Move?] = Array(repeating: nil, count: 9) | ||
@Published var isProfileShown: Bool = false | ||
|
||
var gameType: GameType = GameType.singlePlayer | ||
} |
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,59 @@ | ||
// | ||
// CancelBag.swift | ||
// TicTacToe | ||
// | ||
// Created by Vlad Shkodich on 07.06.2022. | ||
// | ||
|
||
import Combine | ||
import class Foundation.NSLock | ||
|
||
final class CancelBag { | ||
|
||
private var subscriptions: Set<AnyCancellable> = Set<AnyCancellable>() | ||
private let lock: NSLock = NSLock() | ||
|
||
deinit { | ||
cancelAll() | ||
} | ||
|
||
func insert(_ cancellable: AnyCancellable) { | ||
lock.lock() | ||
defer { | ||
lock.unlock() | ||
} | ||
subscriptions.insert(cancellable) | ||
} | ||
|
||
func contains(_ cancellable: AnyCancellable) -> Bool { | ||
lock.lock() | ||
defer { | ||
lock.unlock() | ||
} | ||
return subscriptions.contains(cancellable) | ||
} | ||
|
||
func contains(where predicate: (AnyCancellable) throws -> Bool) rethrows -> Bool { | ||
lock.lock() | ||
defer { | ||
lock.unlock() | ||
} | ||
return try subscriptions.contains(where: predicate) | ||
} | ||
|
||
func cancel(_ cancellable: AnyCancellable) { | ||
lock.lock() | ||
defer { | ||
lock.unlock() | ||
} | ||
subscriptions.remove(cancellable) | ||
} | ||
|
||
func cancelAll() { | ||
lock.lock() | ||
defer { | ||
lock.unlock() | ||
} | ||
subscriptions.removeAll() | ||
} | ||
} |
Oops, something went wrong.