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
func animals(_ chicken: Int,_ cow:Int, _ pigs: Int) -> Int { | |
let legsTwo = 2 | |
let legsFour = 4 | |
let c = legsTwo * chicken | |
let v = legsFour * (cow + pigs) | |
print(c + v ) | |
return c + v |
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 { | |
@StateObject var vmLearn: LearnViewModel | |
@State private var isDescription = false | |
var body: some View { | |
ZStack{ | |
RoundedRectangle(cornerRadius: 10).stroke(Color(hex: "E5E6E4"), lineWidth: 1) | |
VStack(spacing: 20){ | |
HStack{ |
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
// | |
// FirebaseManager.swift | |
// logbookLanguage | |
// | |
// Created by Christophe on 25/02/2022. | |
// | |
import Foundation | |
import Firebase |
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 Learn: Identifiable { | |
var id = UUID().uuidString | |
var _word1: String | |
var _word2: String | |
var _note: String? | |
init(dict: [String: Any]){ | |
self._word1 = dict[WORD1] as? String ?? "" | |
self._word2 = dict[WORD2] as? String ?? "" | |
self._note = dict[NOTE] as? 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
class LearnViewModel: ObservableObject { | |
@Published var count = 0 | |
@Published var learns: [Learn] = [] | |
@Published var word: String = "" | |
@Published var word2: String = "" | |
@Published var note: String = "" | |
let manager = FirebaseManager.shared | |
init() { |
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 TchatAppApp: App { | |
@Environment(\.scenePhase) var scenePhase | |
var body: some Scene { | |
WindowGroup { | |
ContentView(authVM: AuthViewModel()) | |
.onChange(of: scenePhase) { scenePhase in | |
if scenePhase == .background { | |
print("background") | |
// mettre l'user offline |
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 Login: View { | |
@StateObject var viewModel: AuthViewModel = AuthViewModel() | |
// Mark: FaceID Propreties | |
@State var useFaceID: Bool = false | |
var body: some View { |
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() |
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 logbookLanguageApp: App { | |
// MARK: Intialize Firebase | |
init(){ | |
FirebaseApp.configure() | |
} | |
var body: some Scene { | |
WindowGroup { | |
ContentView().environmentObject(AuthViewModel.shared) | |
} |
NewerOlder