iOS simple controller works

This commit is contained in:
Piv
2020-05-06 21:44:42 +09:30
parent 9376bd70ed
commit 4b3b960d22
7 changed files with 90 additions and 97 deletions

View File

@@ -8,20 +8,18 @@
import Foundation
struct UserKeys{
static let host = "host"
static let port = "port"
}
final class ServerData: ObservableObject{
// TODO: Find a way to save/represent this stuff in iOS settings/preferences (user can access via settings app).
// Then load the below values ar runtime, from settings.
// Ideally want to be able to open this settings page from within the app as well.
@Published var port: Int = 50051
@Published var grpcPort: Int = 50050
@Published var host: String = "10.0.0.53"
@Published var host: String = UserDefaults.standard.string(forKey: UserKeys.host) ?? "10.0.0.53"
@Published var grpcPort: Int = UserDefaults.standard.integer(forKey: UserKeys.port)
func load(){
// Load the server values from settings, if they had been
// previously saved.
// Load the server values from settings, if they had been previously saved.
}
func save(){