Skip to content

Commit 76aa162

Browse files
CypherPoetCypherPoet
authored andcommitted
Setup initial version of Project 16
1 parent 57bcabe commit 76aa162

31 files changed

Lines changed: 1479 additions & 8 deletions

File tree

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ I'm currently seeking freelance, remote opportunities as an iOS developer! If yo
8585
- **Day 76:** [_Project 15: Accessibility_ (Part Three)](./day-076/)
8686
- **Day 77:** [Milestone for Projects 13-15 (Part One)](./day-077/)
8787
- **Day 78:** [Milestone for Projects 13-15 (Part Two)](./day-078/)
88-
- **Day 79:** [_Project 16: QRCollector (Part One)_](./day-079/)
89-
- **Day 80:** [_Project 16: QRCollector (Part Two)_](./day-080/)
90-
- **Day 81:** [_Project 16: QRCollector (Part Three)_](./day-081/)
88+
- **Day 79:** [_Project 16: QRConnections (Part One)_](./day-079/)
89+
- **Day 80:** [_Project 16: QRConnections (Part Two)_](./day-080/)
90+
- **Day 81:** [_Project 16: QRConnections (Part Three)_](./day-081/)
9191

9292
</details>
9393

94-
- **Day 82:** [_Project 16: QRCollector (Part Four)_](./day-082/)
94+
- **Day 82:** [_Project 16: QRConnections (Part Four)_](./day-082/)
9595

9696

9797

day-079/Projects/QRConnections/QRConnections.xcodeproj/project.pbxproj

Lines changed: 548 additions & 0 deletions
Large diffs are not rendered by default.

day-079/Projects/QRConnections/QRConnections.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//
2+
// AppDelegate.swift
3+
// QRConnections
4+
//
5+
// Created by Brian Sipple on 1/9/20.
6+
// Copyright © 2020 CypherPoet. All rights reserved.
7+
//
8+
9+
import UIKit
10+
import CoreData
11+
12+
@UIApplicationMain
13+
class AppDelegate: UIResponder, UIApplicationDelegate {
14+
15+
16+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
17+
// Override point for customization after application launch.
18+
CurrentApp.coreDataManager.setup()
19+
20+
return true
21+
}
22+
23+
24+
// MARK: UISceneSession Lifecycle
25+
26+
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
27+
// Called when a new scene session is being created.
28+
// Use this method to select a configuration to create the new scene with.
29+
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
30+
}
31+
32+
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
33+
// Called when the user discards a scene session.
34+
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
35+
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
36+
}
37+
}
38+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//
2+
// CurrentApplication.swift
3+
// QRConnections
4+
//
5+
// Created by CypherPoet on 1/9/20.
6+
// ✌️
7+
//
8+
9+
import Foundation
10+
import CypherPoetCoreDataKit_CoreDataManager
11+
12+
13+
struct CurrentApplication {
14+
var coreDataManager: CoreDataManager
15+
}
16+
17+
18+
var CurrentApp = CurrentApplication(
19+
coreDataManager: .shared
20+
)
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
//
2+
// SceneDelegate.swift
3+
// QRConnections
4+
//
5+
// Created by Brian Sipple on 1/9/20.
6+
// Copyright © 2020 CypherPoet. All rights reserved.
7+
//
8+
9+
import UIKit
10+
import SwiftUI
11+
import CoreData
12+
13+
14+
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
15+
16+
var window: UIWindow?
17+
18+
19+
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
20+
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
21+
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
22+
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
23+
24+
25+
// Use a UIHostingController as window root view controller.
26+
if let windowScene = scene as? UIWindowScene {
27+
let window = UIWindow(windowScene: windowScene)
28+
29+
// Get the managed object context from the shared persistent container.
30+
let managedObjectContext = CurrentApp.coreDataManager.mainContext
31+
32+
#if targetEnvironment(simulator)
33+
setupSimulatorSampleData(in: managedObjectContext)
34+
#endif
35+
36+
// Create the SwiftUI view and set the context as the value for the managedObjectContext environment keyPath.
37+
// Add `@Environment(\.managedObjectContext)` in the views that will need the context.
38+
let contentView = RootView()
39+
.environment(\.managedObjectContext, managedObjectContext)
40+
41+
window.rootViewController = UIHostingController(rootView: contentView)
42+
43+
self.window = window
44+
window.makeKeyAndVisible()
45+
}
46+
}
47+
48+
func sceneDidDisconnect(_ scene: UIScene) {
49+
// Called as the scene is being released by the system.
50+
// This occurs shortly after the scene enters the background, or when its session is discarded.
51+
// Release any resources associated with this scene that can be re-created the next time the scene connects.
52+
// The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
53+
}
54+
55+
func sceneDidBecomeActive(_ scene: UIScene) {
56+
// Called when the scene has moved from an inactive state to an active state.
57+
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
58+
}
59+
60+
func sceneWillResignActive(_ scene: UIScene) {
61+
// Called when the scene will move from an active state to an inactive state.
62+
// This may occur due to temporary interruptions (ex. an incoming phone call).
63+
}
64+
65+
func sceneWillEnterForeground(_ scene: UIScene) {
66+
// Called as the scene transitions from the background to the foreground.
67+
// Use this method to undo the changes made on entering the background.
68+
}
69+
70+
func sceneDidEnterBackground(_ scene: UIScene) {
71+
// Called as the scene transitions from the foreground to the background.
72+
// Use this method to save data, release shared resources, and store enough scene-specific state information
73+
// to restore the scene back to its current state.
74+
75+
// Save changes in the application's managed object context when the application transitions to the background.
76+
CurrentApp.coreDataManager.saveContexts()
77+
}
78+
79+
80+
private func setupSimulatorSampleData(in managedObjectContext: NSManagedObjectContext) {
81+
let _ = SampleData.makeContacts(in: managedObjectContext)
82+
try? managedObjectContext.save()
83+
}
84+
}
85+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
3+
<dependencies>
4+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
5+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
6+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
7+
</dependencies>
8+
<scenes>
9+
<!--View Controller-->
10+
<scene sceneID="EHf-IW-A2E">
11+
<objects>
12+
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
13+
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
14+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
15+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
16+
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
17+
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
18+
</view>
19+
</viewController>
20+
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
21+
</objects>
22+
<point key="canvasLocation" x="53" y="375"/>
23+
</scene>
24+
</scenes>
25+
</document>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// CoreDataManager+Utils.swift
3+
// QRConnections
4+
//
5+
// Created by CypherPoet on 1/9/20.
6+
// ✌️
7+
//
8+
9+
import Foundation
10+
import CypherPoetCoreDataKit_CoreDataManager
11+
12+
13+
extension CoreDataManager {
14+
static let shared = CoreDataManager(
15+
managedObjectModelName: "QRConnections"
16+
)
17+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// Contact+CoreDataClass.swift
3+
// QRConnections
4+
//
5+
// Created by Brian Sipple on 1/10/20.
6+
// Copyright © 2020 CypherPoet. All rights reserved.
7+
//
8+
//
9+
10+
import Foundation
11+
import CoreData
12+
13+
@objc(Contact)
14+
public class Contact: NSManagedObject {
15+
16+
}
17+
18+
extension Contact: Identifiable {}

0 commit comments

Comments
 (0)