mirror of
https://github.com/ivanvorobei/SwiftUI.git
synced 2026-04-23 00:58:41 +02:00
Just a couple of Combine Publishers to go.
This commit is contained in:
@@ -42,7 +42,7 @@ struct AddCurrencyView : View {
|
||||
}
|
||||
}
|
||||
}
|
||||
}.navigationBarItem(title: Text("Add Currency"))
|
||||
}.navigationBarTitle(Text("Add Currency"))
|
||||
}
|
||||
|
||||
private func select(_ currency: Currency) {
|
||||
|
||||
@@ -37,6 +37,7 @@ struct ConverterView : View {
|
||||
let doubleValue: Double = Double(self.$baseAmount.value) ?? 1.0
|
||||
|
||||
return ZStack(alignment: Alignment.bottomTrailing) {
|
||||
NavigationView {
|
||||
VStack(alignment: .leading){
|
||||
Text("From:").bold().color(.gray)
|
||||
HStack{
|
||||
@@ -69,7 +70,7 @@ struct ConverterView : View {
|
||||
}
|
||||
}
|
||||
}.onAppear(perform: loadCurrencies)
|
||||
.navigationBarItem(title: Text("Currenceis 💱"))
|
||||
.navigationBarTitle(Text("Currencies 💱"))
|
||||
.navigationBarItems(trailing: Button(action: { self.isEditing.toggle() }) {
|
||||
if !self.isEditing {
|
||||
Text("Edit")
|
||||
@@ -77,9 +78,11 @@ struct ConverterView : View {
|
||||
Text("Done").bold()
|
||||
}
|
||||
})
|
||||
HStack {
|
||||
Text("Last updated: \(self.lastUpdated)").color(.gray).bold()
|
||||
}
|
||||
NavigationButton(destination: AddCurrencyView().environmentObject(self.userData)) {
|
||||
Spacer()
|
||||
|
||||
NavigationLink(destination: AddCurrencyView().environmentObject(self.userData)) {
|
||||
Text("💰")
|
||||
}.frame(width: 46, height: 46, alignment: .center)
|
||||
.background(
|
||||
@@ -88,6 +91,9 @@ struct ConverterView : View {
|
||||
.border(Color(red: 0.7, green: 0.7, blue: 0.7), width: 1 / UIScreen.main.scale, cornerRadius: 23))
|
||||
.foregroundColor(.white).font(.largeTitle)
|
||||
}.padding()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func loadCurrencies() {
|
||||
|
||||
@@ -37,12 +37,12 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
|
||||
|
||||
// Use a UIHostingController as window root view controller
|
||||
let window = UIWindow(frame: UIScreen.main.bounds)
|
||||
window.rootViewController = UIHostingController(rootView: NavigationView {
|
||||
ConverterView().environmentObject(UserData())
|
||||
})
|
||||
self.window = window
|
||||
window.makeKeyAndVisible()
|
||||
if let windowScene = scene as? UIWindowScene {
|
||||
let window = UIWindow(windowScene: windowScene)
|
||||
window.rootViewController = UIHostingController(rootView: ConverterView().environmentObject(UserData()))
|
||||
self.window = window
|
||||
window.makeKeyAndVisible()
|
||||
}
|
||||
}
|
||||
|
||||
func sceneDidDisconnect(_ scene: UIScene) {
|
||||
|
||||
Reference in New Issue
Block a user