0

I´m in the middle of making an order placement app for iPhone using swift. The app itself is coming along great, but I have a couple of issues I need some help with:

  • When the user starts the app for the first time, he must make an account with name and address. I can make a basic form for this, but the app must store the information so that the user doesn't´ have to log in every time. How is this done?

  • When the user presses the "order" button, the order needs to be sent (with name and address from above) to the store´s webpage to be processed. How is this done?

I hope someone can help me out with this, or point me in the right direction.

Eccles
  • 394
  • 1
  • 3
  • 13

1 Answers1

0

Issue number 1 : store the property if user logged in in defaults i.e

@IBAction func loginTapped(_ sender : UIButton) {
if loginSuccssfull{
UserDefaults.standard.set(true , forKey : "loggedIn")
}
}

Then in your first view controllers view did load add following lines

if !UserDefaults.standard.bool(forKey : "loggedIn"){
 // present login screen
}
else {
 // continue normal 
 }

Here your are just saving when user logged in and checking if he is already logged in ...

For your second issue you can get help from the following answer on Stackoverflow HTTP Request in Swift with POST method

Community
  • 1
  • 1
Abdul Waheed
  • 863
  • 8
  • 14