Who doesn’t use chat apps? WhatsApp, Viber, Line, Messages. They’re arguably the most-used apps on smartphones. We’ve combined a beautiful, clean chat layout with a simple collaborative notes screen, and the ability to tag all notes and chats into projects, on the Projects view. Start with the template, create a backend (perhaps using Amazon Web Services, Parse Server, or Firebase) and hook it all up into a super useful, super popular chat app. It’s future-proofed too, as it’s written in Apple’s modern Swift language.
//
// ChatViewController.swift
// Chat
//
// Created by My App Templates Team on 24/08/14.
// Copyright (c) 2014 My App Templates. All rights reserved.
//
import UIKit
class ChatViewController: UIViewController {
@IBOutlet var viewForTitle : UIView!
@IBOutlet var ctrlForChat : UISegmentedControl!
@IBOutlet var btnForLogo : UIButton!
@IBOutlet var itemForSearch : UIBarButtonItem!
@IBOutlet var tblForChat : UITableView!
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
// Custom initialization
}
required init(coder aDecoder: NSCoder)
{
super.init(coder: aDecoder)
}
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.titleView = viewForTitle
self.navigationItem.leftBarButtonItem = UIBarButtonItem(customView: btnForLogo)
self.navigationItem.rightBarButtonItem = itemForSearch
self.tabBarController?.tabBar.tintColor = UIColor.greenColor()
self.performSegueWithIdentifier("loginSegue", sender: nil)
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func unwindToChat (segueSelected : UIStoryboardSegue) {
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 10
}
func numberOfSectionsInTableView(tableView: UITableView!) -> Int {
return 1
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
if (indexPath.row%2 == 0){
return tblForChat.dequeueReusableCellWithIdentifier("ChatPrivateCell") as UITableViewCell
} else {
return tblForChat.dequeueReusableCellWithIdentifier("ChatPublicCell") as UITableViewCell
}
}
func tableView(tableView: UITableView!, didSelectRowAtIndexPath indexPath: NSIndexPath!){
self.performSegueWithIdentifier("slideToChat", sender: nil);
}
/*
// #pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue?, sender: AnyObject?) {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
}