-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAuthService.swift
More file actions
51 lines (42 loc) · 1.09 KB
/
AuthService.swift
File metadata and controls
51 lines (42 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
// AuthService.swift
// StudyApp
//
// Created by Kevin Mello on 8/27/25.
//
import Foundation
import Combine
final class AuthService: ObservableObject {
static let shared = AuthService()
@Published var isLoggedIn: Bool {
didSet {
UserDefaults.standard.set(isLoggedIn, forKey: "isLoggedIn")
}
}
private init() {
self.isLoggedIn = UserDefaults.standard.bool(forKey: "isLoggedIn")
}
// MARK: - Email & Password Login
func login(email: String, password: String) -> Bool {
// Placeholder logic for now
let valid = !email.isEmpty && !password.isEmpty
isLoggedIn = valid
return valid
}
func logout() {
isLoggedIn = false
}
// MARK: - Third-party login placeholders
func loginWithGoogle() {
// Placeholder for Google sign-in
isLoggedIn = true
}
func loginWithApple() {
// Placeholder for Apple sign-in
isLoggedIn = true
}
// MARK: - Guest login
func continueAsGuest() {
isLoggedIn = true
}
}