Skip to content

Instantly share code, notes, and snippets.

View hrvolapeter's full-sized avatar
🔨
Bitwelding

Peter Hrvola hrvolapeter

🔨
Bitwelding
View GitHub Profile
@hrvolapeter
hrvolapeter / User.swift
Created March 22, 2020 17:56
Zetten - user part 6
struct User {
var uid: String
var email: String?
var displayName: String?
}
import Foundation
import Resolver
extension Resolver: ResolverRegistering {
public static func registerAllServices() {
register { AuthenticationService() }.scope(application)
}
}
import SwiftUI
import Resolver
struct ContentView: View {
@ObservedObject var authenticationService: AuthenticationService = Resolver.resolve()
var body: some View {
Group {
if (authenticationService.user == nil) {
LoginView()
@hrvolapeter
hrvolapeter / Podfile
Created March 29, 2020 20:45
podfile zetten
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|
@hrvolapeter
hrvolapeter / CreateAccountView.swift
Created March 29, 2020 21:30
CreateAccountView zetten changes
struct CreateAccountView: View {
@State var email: String = ""
@State var password: String = ""
@Injected var authenticationService: AuthenticationService
...
@hrvolapeter
hrvolapeter / Action.swift
Created March 29, 2020 21:31
Zetten signin action
action: {
self.authenticationService.signUp(email: self.email, password: self.password, handler: {_,_ in })
}
@hrvolapeter
hrvolapeter / Injected.swift
Created March 29, 2020 21:31
Injected zetten
@Injected var authenticationService: AuthenticationService
action: {
self.authenticationService.signIn(email: self.email, password: self.password, handler: {_,_ in })
}
handler: {res,err in
print(res)
print(err)
}
@hrvolapeter
hrvolapeter / Note.swift
Created September 6, 2020 06:08
Zetten note model
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