Skip to content

Commit b468c98

Browse files
committed
Clean code and update example app.
1 parent eb737e4 commit b468c98

7 files changed

Lines changed: 9 additions & 55 deletions

File tree

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,17 @@
11
import UIKit
2+
import SparrowKit
23

34
@main
4-
class AppDelegate: UIResponder, UIApplicationDelegate {
5+
class AppDelegate: SPAppScenesDelegate {
56

67
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
7-
// Override point for customization after application launch.
88
return true
99
}
1010

1111
// MARK: UISceneSession Lifecycle
1212

1313
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
14-
// Called when a new scene session is being created.
15-
// Use this method to select a configuration to create the new scene with.
1614
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
1715
}
18-
19-
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
20-
// Called when the user discards a scene session.
21-
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
22-
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
23-
}
24-
25-
2616
}
2717

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,11 @@
11
import UIKit
2+
import SparrowKit
23

3-
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
4-
5-
var window: UIWindow?
4+
class SceneDelegate: SPWindowSceneDelegate {
65

76
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
8-
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
9-
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
10-
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
11-
guard let _ = (scene as? UIWindowScene) else { return }
12-
}
13-
14-
func sceneDidDisconnect(_ scene: UIScene) {
15-
// Called as the scene is being released by the system.
16-
// This occurs shortly after the scene enters the background, or when its session is discarded.
17-
// Release any resources associated with this scene that can be re-created the next time the scene connects.
18-
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
19-
}
20-
21-
func sceneDidBecomeActive(_ scene: UIScene) {
22-
// Called when the scene has moved from an inactive state to an active state.
23-
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
24-
}
25-
26-
func sceneWillResignActive(_ scene: UIScene) {
27-
// Called when the scene will move from an active state to an inactive state.
28-
// This may occur due to temporary interruptions (ex. an incoming phone call).
7+
guard let scene = (scene as? UIWindowScene) else { return }
8+
makeKeyAndVisible(in: scene, viewController: ViewController(), tint: .systemBlue)
299
}
30-
31-
func sceneWillEnterForeground(_ scene: UIScene) {
32-
// Called as the scene transitions from the background to the foreground.
33-
// Use this method to undo the changes made on entering the background.
34-
}
35-
36-
func sceneDidEnterBackground(_ scene: UIScene) {
37-
// Called as the scene transitions from the foreground to the background.
38-
// Use this method to save data, release shared resources, and store enough scene-specific state information
39-
// to restore the scene back to its current state.
40-
}
41-
42-
4310
}
4411

Example Apps/iOS Example App/Resources/Info.plist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
<string>Default Configuration</string>
1616
<key>UISceneDelegateClassName</key>
1717
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
18-
<key>UISceneStoryboardFile</key>
19-
<string>Main</string>
2018
</dict>
2119
</array>
2220
</dict>

Sources/SPQRCode/Interface/SPQRCameraController+AVCaptureMetadataOutputObjectsDelegate.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2020
// SOFTWARE.
2121

22-
2322
import UIKit
2423
import AVKit
2524

Sources/SPQRCode/Interface/SPQRCorner.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2020
// SOFTWARE.
2121

22-
2322
import Foundation
2423
import CoreGraphics
2524

2625
struct SPQRCorner: Equatable {
26+
2727
enum Kind: Int, CaseIterable {
28+
2829
case topLeft = 0
2930
case bottomLeft = 1
3031
case bottomRight = 2

Sources/SPQRCode/Interface/SPQRDetailButton.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2020
// SOFTWARE.
2121

22-
2322
import UIKit
2423
import SparrowKit
2524

Sources/SPQRCode/Interface/SPQRFrameLayer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2020
// SOFTWARE.
2121

22-
2322
import UIKit
2423

2524
class SPQRFrameLayer: CAShapeLayer {
25+
2626
private let cLength: CGFloat
2727
private let cRadius: CGFloat
2828

0 commit comments

Comments
 (0)