This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// RequestManager.swift | |
// APISearchControllerTutorial | |
// | |
// Created by Kc on 24/03/2016. | |
// Copyright © 2016 Kenechi Okolo. All rights reserved. | |
// | |
import Foundation | |
import Alamofire |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: 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)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
} |
OlderNewer