-
Notifications
You must be signed in to change notification settings - Fork 109
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 #231 from weiran/swiftui-login
New Login UI
- Loading branch information
Showing
19 changed files
with
321 additions
and
359 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 |
---|---|---|
|
@@ -19,4 +19,6 @@ type_name: | |
identifier_name: | ||
excluded: | ||
- id | ||
- by | ||
- by | ||
allowed_symbols: | ||
- _body |
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
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
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,38 @@ | ||
// | ||
// SwinjectSwiftUI.swift | ||
// Hackers | ||
// | ||
// Created by Weiran Zhang on 04/04/2022. | ||
// Copyright © 2022 Glass Umbrella. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
import Swinject | ||
import SwinjectStoryboard | ||
|
||
@propertyWrapper | ||
struct Inject<Component> { | ||
let wrappedValue: Component | ||
init() { | ||
self.wrappedValue = Resolver.shared.resolve(Component.self) | ||
} | ||
} | ||
|
||
class Resolver { | ||
static let shared = Resolver() | ||
private let container = buildContainer() | ||
|
||
func resolve<T>(_ type: T.Type) -> T { | ||
container.resolve(T.self)! | ||
} | ||
} | ||
|
||
func buildContainer() -> Container { | ||
let container = SwinjectStoryboard.defaultContainer | ||
|
||
container.register(SessionService.self) { _ in | ||
return SessionService() | ||
}.inObjectScope(.container) | ||
|
||
return container | ||
} |
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
Oops, something went wrong.