featured-image-ios

Fetch and Update User Data for iOS Mobile App using Mesosfer – Part 4

In this tutorial, we will learn how to Fetch and Update User Data for iOS Mobile App using Mesosfer Backend as a Service. Download all code :

ios-objective-cios-swift

1. Introduction

This is the fourth session of tutorial series. You can read the previous session here. In this section, we’ll create an iOS app that Fetch and Update User Data based on  Mesosfer Documentation.

2. Prerequisites

To follow the step in this tutorial, you should set up some prerequisites below:

  • Sign up for an account in Mesosfer Backend as a Service.
  • Install the latest Xcode. In this tutorial, the author used Xcode 8.1 (8B62).
  • You can download the code from previous session here.

3. Getting Started

3.1. Designing views

Add a static cell for Profile menu in main view. Then create a profile view on your Main.storyboard. Connect the new menu and profile view with Triggered Segues -> Selection -> Show like below :

main-profile-storyboard

Like the register view, profile view contains :

  • Email Address (UITextField), used for entering login email credential.
  • First Name (UITextField), used for entering first name of user.
  • Last Name (UITextField), used for entering last name of user.
  • Birth of Date (UITextField), used for entering date of birth using format “yyyy-MM-dd”
  • Height (UITextField), used for entering height (double number) of user.
  • Weight (UITextField), used for entering weight (integer number) of user.
  • IsMarried (UISwitch), used for choosing married status of user.
  • Update Profile (UITableViewCell), used for updating user data to the Mesosfer Cloud.

For additional, you can add view to change your password :

  • Old Password (UITextField), is current user password that used for login credential.
  • New Password (UITextField), is new password that used to replace current password for login credential.
  • Confirm New Password (UITextField), used to confirm the new password input value.
  • Change Password (UITableViewCell), used for changing user password to the Mesosfer Cloud.

3.2. Referencing the outlets

Add ProfileViewController class to your Xcode project, then add referencing outlet for each object library :

Objective-C

Swift

3.3. Completing the codes

3.3.1. ProfileViewController complete code :

Objective-C

  • .h file

  • .m file

Swift

 

4. Conclusion

We’ve already created fetch and update user module in iOS mobile app. It’s an easy way for developers. So enjoy creating your Mobile application using Mesosfer Backend as a Service. Mesosfer helps you connect your project to the cloud. Cut off the development process so you can straight into the delivery process instead stumble on the complicated infrastructure.

Lead Mobile Software Engineer. Having more than 8 years in IT Consultant. Love working with new mobile platform technology. Expert in Android and iOS Mobile Development.