With the current trends in the software development field, agility and faster delivery of software applications have become an essential part of the IT industry. In fact, this has been one of the main reasons for the evolution of many of the modern technologies and trends, such as single-page applications, lightweight frameworks, and microservices architecture.

Even with the massive improvements in the technologies, IDEs, and tools, developers still write much code to get the job done. To increase software developers’ productivity and to reduce the cost of software development, the Clowiz platform has been created.

Clowiz is a cloud-based platform that enables developers to generate software artifacts (using CodeGen), end-to-end features (using FeatureGen), and full end-to-end apps (using AppGen) without writing a single line of code. 

In this article, we are going to:

  1. Create and set up the following projects:
    • iOS Swift App
    • Spring Boot Rest API
  2. Generate app artifacts using Clowiz:
    • Generate and use the following artifacts in the iOS App:
      • List ViewController
      • Add/Edit ViewController
      • List View
      • Add/Edit View
      • Model 
      • Alamofire Sevice
    • Generate and use the following artifacts in the Spring Boot App:
      • JPA Repository
      • Entity
      • Rest API Controller
  3. Run and test the project

Create iOS Swift App

Using XCode:

  • Create a new iOS Storyboard project with a Single View App.
  • Add Alamofire POD to the project. (How to add Alamofire to xCode,  Alamofire latest version)
  • Delete the “Main.storyboard” file and its references from the “Info.plist” file. (Create project without storyboard)
  • Rename the file “ViewController.swift” to “TabBarVC.swift”. 
  • Change the class name to TabBarVC.
  • Change the rootViewCntroller to a to our TabBarVC by replacing the scene function in the SceneDelegate.swift file with the following:
  • Create a new subclass of UIViewController and call it “HomeVC.swift” with the following content:
  • Add UINavigationController to your tabs in the TabBarVC class.

Running the app displays the TabBar and an empty Home navigation page, now we can extend the app and add more functionalities to it.

Generate iOS Artifacts

To boost the development process, use the CodeGen feature from Clowiz to generate the project artifacts source code in one minute for both applications.

Clowiz CodeGen

To generate the artifacts for both applications, iOS, and Spring Boot:
  1. Go to Clowiz, then navigate to CodeGen https://www.clowiz.com/
  2. From the technologies, choose iOS.
  3. In the metadata section, name your artifacts, e.g., Employee.
  4. For the first field, in the field name, type Name and keep is as Text.
  5. Create two more fields, e.g., Email and Salary, with data types of email and double.
  6. Check all fields as required. 

CodeGen has generated the following artifacts for the project:


Cell View: represents the data in each table row: 


Add Edit View: holds the input fields(name, email, salary input fields) and their labels.

Add Edit VC: used to add and edit data.

List VC: used to list and delete data. 

Service: service layer that uses Alamofire to handle the API requests.

Now let’s add the generated code to the project, you can press on Download Generated Code under the generated code section in CodeGen, then add the downloaded files to the project app folder, or you can copy-paste the generated code to the project. (Please note the file name should match the class name with .swift extension)

Add the EmployeeListViewController to a navigation bar in the TabBar class.

To keep the project simple and easy to maintain, divide it into groups (AddView, AddViewController, CellView, ListViewController, Model, Service).

To run the app, use one of the simulators provided, and press run.


Running the application displays the two tab items Home and Employee. The Employee tab contains a table to list all the employees, search bar,  and a button to add a new employee.

As soon as you access the Employee tab, you get a Network error because we still don’t have an API to handle the requests.

API requests

Create Spring Boot Rest API

Spring Boot reduces lots of development time and increases productivity. It avoids writing lots of boilerplate Codes, Annotations, and XML Configuration, however, just to get started, a lot of code is needed, but don’t worry, Clowiz supports Spring Boot, and can generate the code for our API in a minute.


Create a new Spring Boot project using Spring Initializr:

  1. Leave the default settings as Maven Project, Java, and the version.
  2. In the Group field type: com.app
  3. In the Artifact field type: iosBackend
  4. From the Options, change the package name to com.app
  5. Search and add the following dependencies:
    • Spring web
    • Spring Data JPA
    • MySQL Driver
  6. Press on Generate to download the project.

Using any eclipse based IDE:

  1. Import the downloaded project. (File -> Import -> Existing Maven Project)
  2. Add the following to the “application.properties” file in the “src/main/resources package”.

We don’t have to create a database manually; Spring JPA does that automatically, note the parameter  createDatabaseIfNotExist = true in the database URL.

Generate Spring Boot Artifacts

Back to Clowiz, press on the Spring Boot icon in the technologies section to generate the needed source code for the API.

For this tutorial, use the following generated artifacts:

Hibernate JPA Entity (The model).

SpringData Service.

Mature Spring RestController.

As we did in the iOS project, copy-paste the generated code to the right packages with the correct classes names, or you can download it by pressing Download Generated Code.

To keep the project simple and easy to maintain, divide it into packages (controllers, models, repositories).

Check that the URL in the iOS Service class matches with the Spring Boot properties file server IP.

To run the project, open the IosBackendApplication.java class, right-click and Run As Java Application.

You can test it using any tool like Postman, or using any browser, visit: this should return an empty list [] as we don’t have any data in the database.

Running the App

After running the Spring Boot API, rerun the iOS project.

  1. Go to the Employee tab
  2. Press on the Add button
  3. Fill in Employee data
  4. Press on save
  5. Tap on a row to edit it
  6. Swipe a row to delete it

failure message

Source link

Write A Comment