Smart Home Mobile Application | Full Stack

Smart Home App

In this project, I made app for practice JSON parsing for IOS application. In this project I made my own backend service with Heroku and Node.js . Backend side is very simple only send random variable for mobile application. You can find all files and videos in here.

Watch app video

Backend | Node.js

I create simple backend (API) for this example SmartHome Application. I use Node.js for developing. This backend send the json for each specific query. You can download full code in here This backend don’t have storage system such as MongoDB. I developt this backend for my specific query. Also I deploy this backend on Heroku (http://fathomless-stream-95255.herokuapp.com). You can test with Postman and even you can use this for your example project.

Bellow code shows index.js

Index.js

This snippet code shows my login page activity. if user use this routes /login/:username/:password this code works

After that each rooms and sensor variable get with /rooms/:userid/:roomid . Bellow code is not perfect. I don’t prefer to use it. However you can learn concept how to work API

 

Ios Mobile App | Swift

Bellow picture shows the main storyboard. Application have 3 page which are, login, rooms and roomsdetails pages.

Firstly I created models

userModel.swift

roomModel.swift

sensorsModel.swift

currentUser.swift

I create this model for hold the current user in phone memory. I mean, when user close application and start to application again application regonize the current user and doesn’t want to login again.

webService.swift

After that I create ViewControllers codes.

LoginViewController.swift

RoomsViewController.swift

RoomDetailViewController.swift

After that I create collection controllers

RoomCollectionViewCell.swift

SensorTableViewCell.swift

Also I added in Delegate code for saving current user id.

AppDelegate.swift

 

Leave a Reply

Your email address will not be published. Required fields are marked *