Skip to content

Instantly share code, notes, and snippets.

View ctrevarthen's full-sized avatar

Chris Trevarthen ctrevarthen

View GitHub Profile
@ctrevarthen
ctrevarthen / Fastfile
Last active December 1, 2015 04:25
ShopQuick - Fastfile
desc "Create an unsigned IPA for distribution and resigning"
lane :distro do
makeUnsignedIPA
end
# Creates the unsigned IPA file for distribution
def makeUnsignedIPA
@ctrevarthen
ctrevarthen / tabbar.swift
Last active November 25, 2015 05:37
ShopQuick - Tab Bar Style
let backgroundColor = UIColor.init(red: 61/255, green: 30/255, blue: 94/255, alpha: 1)
let selectedTabColor = UIColor.init(red: 247/255, green: 149/255, blue: 23/155, alpha: 1)
// background color of tabs
UITabBar.appearance().barTintColor = backgroundColor
// prevent the color from being altered by content showing through below
UITabBar.appearance().translucent = false
// prevent default styling of tab bar icons
@ctrevarthen
ctrevarthen / navbar.swift
Last active November 25, 2015 05:21
ShopQuick - Navigation Bar Color
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let backgroundColor = UIColor.init(red: 61/255, green: 30/255, blue: 94/255, alpha: 1)
// background color of the nav bar
UINavigationBar.appearance().barTintColor = backgroundColor
// prevent the color from being altered by content showing through below
UINavigationBar.appearance().translucent = false
@ctrevarthen
ctrevarthen / rule1.swift
Created November 24, 2015 16:19
ShopQuick - Rule 1
class PrioritiesManager : ProductManager {
static let sharedInstance = PrioritiesManager()
var lastProductPurchased : Product?
override init() {
super.init()
self.productsKey = "com.detroitlabs.shopfast.priorities"
self.loadProductsFromDefaults()
@ctrevarthen
ctrevarthen / rule2.swift
Created November 24, 2015 16:18
ShopQuick - Rule 2
func addProduct(product: Product) {
let newProduct = Product(name: product.name, qty: 0)
if let _ = lastProductPurchased,
let index : Int = self.findIndexForProductName(lastProductPurchased!.name) {
// if the new product already exists
if let _ = self.findProductByName(newProduct.name) {
// do nothing -- Rule #2
@ctrevarthen
ctrevarthen / rule4.swift
Last active November 24, 2015 17:17
ShopQuick - Rule 4
func addProduct(product: Product) {
let newProduct = Product(name: product.name, qty: 0)
// if the product exists
if self.doesProductExist(newProduct.name) {
// if there is a last item purchased
if let lastProduct = self.lastProductPurchased {
@ctrevarthen
ctrevarthen / shoppinglist.swift
Created November 24, 2015 16:17
ShopQuick - End shopping trip
class ShoppingListManager : ProductManager {
static let sharedInstance = ShoppingListManager()
let prioritiesManager = PrioritiesManager.sharedInstance
func markPurchasedAtIndex(index: Int) {
let product = self.products[index]
@ctrevarthen
ctrevarthen / rule3.swift
Last active November 24, 2015 17:16
ShopQuick - Priorities Rule 3
func addProduct(product: Product) {
let newProduct = Product(name: product.name, qty: 0)
// if the product exists
if self.doesProductExist(newProduct.name) {
// if there is a last item purchased
if let lastProduct = self.lastProductPurchased {
@ctrevarthen
ctrevarthen / rule3_revised.swift
Created November 24, 2015 16:13
ShopQuick - Priorities Rule 3 Revised
func addProduct(product: Product) {
let newProduct = Product(name: product.name, qty: 0)
// if the product exists
if self.doesProductExist(newProduct.name) {
// if there is a last item purchased
if let lastProduct = self.lastProductPurchased {
@ctrevarthen
ctrevarthen / rule_final.swift
Created November 24, 2015 16:12
ShopQuick - Priorities Rule 3 Final
class PrioritiesManager : ProductManager {
static let sharedInstance = PrioritiesManager()
var productsInThisTrip : [Product]?
func addProduct(product: Product) {
let newProduct = Product(name: product.name, qty: 0)