UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

SOLVED: Question: My decimalPad won't build

Forums > 100 Days of SwiftUI

@boat  

Hello I'm on Project 1

https://www.hackingwithswift.com/books/ios-swiftui/reading-text-from-the-user-with-textfield

I'm following Paul's codes step by step. When I built through command R , my decimal keyboard don't appear when I'm trying to type. (But in Paul's demonstration his worked)

Here's my code. Is there anything wrong ?

I'm building on Simulator of iPhone 13 Pro ( iOS 15.0 )

// // ContentView.swift // WeSplit // // Created by Boat on 2/12/21. //

import SwiftUI

struct ContentView: View { @State private var checkAmount = 0.0 @State private var numberOfPeople = 2 @State private var tipPercentage = 20

let tipPercentages = [10,15,20,25,0]

var body: some View {
    Form {
        Section {
            TextField ("Amount", value: $checkAmount, format:.currency(code: Locale.current.currencyCode ?? "USD"))
                .keyboardType(.decimalPad)
        }

        Section {
            Text (checkAmount, format:.currency(code: Locale.current.currencyCode ?? "USD"))
        }
    }
}

}

struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }

2      

When running the simulator and the text field selected, do CMD-K to bring up the keyboard.

4      

TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!

Find out more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.