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 Combine | |
class ImageLoader: ObservableObject { | |
var downloadedImage: UIImage? | |
let didChange = PassthroughSubject<ImageLoader?, Never>() | |
func load(url: 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
import SwiftUI | |
struct CardView: View { | |
var item: ActivityModel | |
var body: some View { | |
VStack { | |
URLImage(url: item.image) | |
Text(item.heading) | |
.font(Font.system(size: 20)) |
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 ListRowView: View { | |
var activity: ActivityModel | |
var body: some View { | |
NavigationLink( | |
destination: DetailVIew(activity: activity), | |
label: { | |
CardView(item: activity) | |
}) | |
} |
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 | |
struct NewView: View { | |
@State var showSetting = false | |
//MARK: Properties | |
@ObservedObject var session = ActivityModelFirebase() | |
var body: some View { | |
NavigationView{ | |
ScrollView { |
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 Fluent | |
import Vapor | |
struct UserController { | |
func create(req: Request) throws -> EventLoopFuture<User> { | |
let receivedData = try req.content.decode(User.Create.self) | |
let user = try User(name: receivedData.name, | |
email: receivedData.email, | |
passwordHash: Bcrypt.hash(receivedData.password)) | |
return user.save(on: req.db).transform(to: user) |
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 Fluent | |
import Vapor | |
func routes(_ app: Application) throws { | |
let userController = UserController() | |
let basicGroup = app.grouped(User.authenticator()) | |
.grouped(User.guardMiddleware()) | |
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
// | |
// ExoModelFirebase.swift | |
// | |
import Foundation | |
import FirebaseDatabase | |
class ExoModelFirebase: ObservableObject { | |
var ref = Database.database().reference() |
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 logbookLanguageApp: App { | |
// MARK: Intialize Firebase | |
init(){ | |
FirebaseApp.configure() | |
} | |
var body: some Scene { | |
WindowGroup { | |
ContentView().environmentObject(AuthViewModel.shared) | |
} |
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 Firebase | |
import LocalAuthentication | |
class AuthViewModel: ObservableObject { | |
@Published var userSession: FirebaseAuth.User? | |
@Published var showError: Bool = false | |
@Published var msgError: String = "" | |
@Published var email = "" |
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 ContentView: View { | |
@State var isActive = false | |
@EnvironmentObject var viewModel: AuthViewModel | |
var body: some View { | |
VStack { | |
if isActive { | |
if viewModel.userSession == nil { | |
Login() |