-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
StringView; quickphrase; reload wbx config
- Loading branch information
1 parent
979ad60
commit 7cc4369
Showing
4 changed files
with
32 additions
and
0 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 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,22 @@ | ||
import SwiftUI | ||
|
||
struct StringView: View { | ||
let description: String | ||
@ObservedObject private var viewModel: OptionViewModel<String> | ||
|
||
init(data: [String: Any], onUpdate: @escaping (String) -> Void) { | ||
description = data["Description"] as! String | ||
viewModel = OptionViewModel( | ||
value: data["Value"] as! String, | ||
defaultValue: data["DefaultValue"] as! String, | ||
onUpdate: onUpdate | ||
) | ||
} | ||
|
||
var body: some View { | ||
HStack { | ||
Text(description) | ||
TextField("", text: $viewModel.value).resettable(viewModel) | ||
} | ||
} | ||
} |
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