-
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add UserManagement example (#161)
* docs: add UserManagement example * Remove ProductSample folder * Build examples on CI
- Loading branch information
Showing
21 changed files
with
654 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,6 +118,8 @@ extension Message { | |
} | ||
} | ||
|
||
#Preview { | ||
ContentView() | ||
} | ||
#if swift(>=5.9) | ||
#Preview { | ||
ContentView() | ||
} | ||
#endif |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// AppView.swift | ||
// UserManagement | ||
// | ||
// Created by Guilherme Souza on 17/11/23. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct AppView: View { | ||
@State var isAuthenticated = false | ||
|
||
var body: some View { | ||
Group { | ||
if isAuthenticated { | ||
ProfileView() | ||
} else { | ||
AuthView() | ||
} | ||
} | ||
.task { | ||
for await state in await supabase.auth.onAuthStateChange() { | ||
if [.initialSession, .signedIn, .signedOut].contains(state.event) { | ||
isAuthenticated = state.session != nil | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
#if swift(>=5.9) | ||
#Preview { | ||
AppView() | ||
} | ||
#endif |
11 changes: 11 additions & 0 deletions
11
Examples/UserManagement/Assets.xcassets/AccentColor.colorset/Contents.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"colors" : [ | ||
{ | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Oops, something went wrong.