Skip to content

Instantly share code, notes, and snippets.

View kenechiokolo's full-sized avatar

KC Okolo kenechiokolo

View GitHub Profile
@kenechiokolo
kenechiokolo / RequestManager.swift
Last active April 24, 2017 17:46
APISearchControllerTutorial using delegation instead of KVO
//
// RequestManager.swift
// APISearchControllerTutorial
//
// Created by Kc on 24/03/2016.
// Copyright © 2016 Kenechi Okolo. All rights reserved.
//
import Foundation
import Alamofire
//: Playground - noun: a place where people can play
func uniqueString(name: String, list: [String]) -> String {
var suffix = 0
func nameCheck(n: String) -> String {
var localName = n
guard list.contains(localName) else { return n }
suffix += 1
localName = name + "-\(suffix)"
// 1. Before
static var titles: [String] {
var i = 0
var titles: [String] = []
while let categoryTitle = StudyCategory(rawValue: i)?.title {
titles.append(categoryTitle)
i += 1
}
return titles
}