This file contains hidden or 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
| import Foundation | |
| class NoteListViewModel: ObservableObject { | |
| @Published var notes = [ | |
| Note.init(id: "0", title: "Note 0", createdTime: .init(), content: "Content of note 0", userId: "0", deleted: nil, parentId: nil, tags: ["tag 1"]), | |
| Note.init(id: "1", title: "Note 1", createdTime: .init(), content: "Content of note 1", userId: "0", deleted: nil, parentId: nil, tags: ["Tag 1"]) | |
| ] | |
| } |
This file contains hidden or 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
| import FirebaseFirestore | |
| import FirebaseFirestoreSwift | |
| import Foundation | |
| import GRDB | |
| struct Note: Codable, Identifiable { | |
| var id: String = UUID().uuidString | |
| var title: String | |
| var createdTime = Timestamp() | |
| var content: String |
This file contains hidden or 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
| handler: {res,err in | |
| print(res) | |
| print(err) | |
| } |
This file contains hidden or 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
| action: { | |
| self.authenticationService.signIn(email: self.email, password: self.password, handler: {_,_ in }) | |
| } |
This file contains hidden or 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
| @Injected var authenticationService: AuthenticationService |
This file contains hidden or 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
| action: { | |
| self.authenticationService.signUp(email: self.email, password: self.password, handler: {_,_ in }) | |
| } |
This file contains hidden or 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
| struct CreateAccountView: View { | |
| @State var email: String = "" | |
| @State var password: String = "" | |
| @Injected var authenticationService: AuthenticationService | |
| ... |
This file contains hidden or 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
| pod 'Firebase/Analytics' | |
| pod 'FirebaseCore' | |
| pod 'Firebase/Auth' | |
| pod 'Firebase/Firestore' | |
| pod 'Firebase/Crashlytics' | |
| pod "FirebaseFirestoreSwift" | |
| pod 'GRDB.swift' | |
| pod 'Resolver' | |
| post_install do |installer| | |
| installer.pods_project.targets.select { |target| target.name == "GRDB.swift" }.each do |target| |
This file contains hidden or 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
| import SwiftUI | |
| import Resolver | |
| struct ContentView: View { | |
| @ObservedObject var authenticationService: AuthenticationService = Resolver.resolve() | |
| var body: some View { | |
| Group { | |
| if (authenticationService.user == nil) { | |
| LoginView() |
This file contains hidden or 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
| import Foundation | |
| import Resolver | |
| extension Resolver: ResolverRegistering { | |
| public static func registerAllServices() { | |
| register { AuthenticationService() }.scope(application) | |
| } | |
| } |