What’s more cool than being rewarded for being a loyal customer? Its being able to easily keep track of your loyalty points and rewards in a handy app. A loyalty app done right can get amazing engagement with your customers, and give you a direct line to them for promotions, feedback and more. So we decided to help you out, and build a coolest Loyalty app template for iPhone ever. Complete with beautiful UI, slick animations and intuitive UX. We’ve done the hard work and created this functional UI template, ready for you to add in your backend API. And we’ve written it in native, modern Apple Swift. So get check out the video of it below, and get started on your amazing Loyalty card app for iOS.
//
// MyCardsViewController.swift
// LoyaltyCard
//
// Copyright (c) 2015 MyAppTemplates. All rights reserved.
//
import UIKit
class MyCardsViewController: UIViewController {
var isSignedIn = false
var arrIcons : NSArray!
var selectedIndexPath = -1
var isTableCellSelected = false
@IBOutlet var tblContents: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
arrIcons = ["card-target.png", "card-ikea-family.png", "card-amazone.png", "card-star-bud.png", "card-itune.png","card-planet.png"]
tblContents.tableFooterView = UIView()
// Do any additional setup after loading the view.
}
override func viewDidAppear(animated: Bool) {
if !isSignedIn {
let appDelegate = UIApplication.sharedApplication().delegate as AppDelegate
appDelegate.showLogin()
isSignedIn = true
}
}
func tableView(tableView: UITableView!, heightForRowAtIndexPath indexPath: NSIndexPath!) -> CGFloat {
if ((indexPath.row == (arrIcons.count - 1)) || (indexPath.row == selectedIndexPath)) {
return 401
} else if (isTableCellSelected) {
return 10
} else {
return 60
}
}
func tableView(tableView: UITableView!, didSelectRowAtIndexPath indexPath: NSIndexPath!) {
if selectedIndexPath == indexPath.row {
selectedIndexPath = -1
isTableCellSelected = false
} else {
selectedIndexPath = indexPath.row
isTableCellSelected = true
}
tableView.beginUpdates()
tableView.endUpdates()
}
func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int {
return arrIcons.count
}
func numberOfSectionsInTableView(tableView: UITableView!) -> Int {
return 1
}
func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
var cell : CardTableViewCell!
cell = tblContents.dequeueReusableCellWithIdentifier("CardCell") as CardTableViewCell
cell.imgIcon.image = UIImage(named: arrIcons.objectAtIndex(indexPath.row) as String)
return cell
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// 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.
}
*/
}