Create repo, add feature to set username

This commit is contained in:
2025-08-17 15:35:01 +02:00
commit 7b84754bd6
14 changed files with 656 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
//
// ContentView.swift
// Peered
//
// Created by Oskar Chybowski on 11/05/2025.
//
import SwiftUI
struct ContentView: View {
@AppStorage("peered_username") private var username: String = ""
@State var browser: CommunicationProvider? = nil
var body: some View {
VStack {
if let browser {
ForEach(browser.availablePeers, id: \.displayName) { peer in
Text(peer.displayName)
}
}
}
.padding()
.sheet(isPresented: .constant(username.isEmpty)) {
SetUserNameBottomSheetView(username: $username)
}
.onChange(of: username) { _, newValue in
guard !newValue.isEmpty else { return }
browser = .init(id: newValue)
}
}
}
#Preview {
ContentView()
}