Skip to content

Commit 3ec4dff

Browse files
committed
Updated to work with beta3
1 parent aafeb61 commit 3ec4dff

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

TipCalculator/TipCalculator/ContentView.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ struct ContentView : View {
1515

1616
private var currencyFormatter: NumberFormatter = {
1717
let f = NumberFormatter()
18+
// allow no currency symbol, extra digits, etc
19+
f.isLenient = true
1820
f.numberStyle = .currency
1921
return f
2022
}()
@@ -49,14 +51,16 @@ struct ContentView : View {
4951
NavigationView {
5052
VStack(spacing: 20) {
5153
Spacer()
52-
53-
TextField($totalInput, formatter: currencyFormatter)
54+
55+
TextField("Total", value: $totalInput, formatter: currencyFormatter)
5456
.font(.largeTitle)
5557
.padding()
5658
.background(Color.white)
59+
.foregroundColor(Color.black)
5760
.multilineTextAlignment(.center)
5861

5962
segmentedTipPercentages
63+
.padding()
6064

6165
Divider()
6266

TipCalculator/TipCalculator/SceneDelegate.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
2020
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
2121

2222
// Use a UIHostingController as window root view controller
23-
let window = UIWindow(frame: UIScreen.main.bounds)
24-
window.rootViewController = UIHostingController(rootView: ContentView())
25-
self.window = window
26-
window.makeKeyAndVisible()
23+
if let windowScene = scene as? UIWindowScene {
24+
let window = UIWindow(windowScene: windowScene)
25+
window.rootViewController = UIHostingController(rootView: ContentView())
26+
self.window = window
27+
window.makeKeyAndVisible()
28+
}
2729
}
2830

2931
func sceneDidDisconnect(_ scene: UIScene) {

0 commit comments

Comments
 (0)