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
| // Basing Modules/Logs, Analytics, Crashlytics/Adding Events (1/4) | |
| /* | |
| The idea here is to eliminate a majority of the duplication while keeping the same event output. | |
| The final result being what is shown below | |
| */ | |
| // MARK: Analytic Events | |
| enum Event: LoggableEvent, EventEnum { |
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
| /// includes USStateAndTerritory enum and USState enum | |
| /// required for retreiving the full name from the enum cases | |
| extension String { | |
| /// Splits a camelCase string and capitalizes each word | |
| /// - Returns: self split into words and capitalized | |
| /// - Note: In its current configuration, it does not | |
| /// follow proper title formatting. |
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
| /// Validation based on RFC 5321, but omitting some | |
| /// cases to conform with email-as-username authentication | |
| /// add those cases as needed | |
| import Foundation | |
| extension String { | |
| var validEmail: Bool { | |
| if exceedsEmailLength() { return false } | |
| if containsDoubleDots() { return false } |
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
| import UIKit | |
| let puzzleInput = "great minds think alike" | |
| var puzzleOutput = "" | |
| let charactersToRemove: [Character] = ["a", "e", "i", "o", "u", " "] | |
| /// When using `continue` in an `if` statement (or switch) of a loop, the | |
| /// loop immediately goes to the next iteration of the loop with completing | |
| /// the rest of the current loop iteration. |
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
| import UIKit | |
| public enum Model : String { | |
| case simulator = "simulator/sandbox", | |
| iPod1 = "iPod 1", | |
| iPod2 = "iPod 2", | |
| iPod3 = "iPod 3", | |
| iPod4 = "iPod 4", | |
| iPod5 = "iPod 5", | |
| iPad2 = "iPad 2", |
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
| if #available(iOS 11, *) { | |
| // if iOS11 parameters isn't enough | |
| if UIDevice().type == .iPhoneX { | |
| // iPhone X parameters | |
| } else { | |
| // iOS11 parameters | |
| } | |
| } else { | |
| // original parameters | |
| } |
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
| //: Interview Question - Handling optionals | |
| import UIKit | |
| // There are four common ways to handle optionals | |
| // in Swift | |
| // if let | |
| var myString: String? | |
| myString = "myString" |
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
| //: Filter, Map, Reduce - Interview question | |
| import UIKit | |
| // Our Skate shop just got a big order of wheels delivered | |
| // We enter the wheels into the system like this: | |
| struct Wheel { | |
| let brand: String | |
| let color: String |
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
| // | |
| // ForbiddenWords-Eng.swift | |
| // Used for filtering user input | |
| // Please forgive the objectionable language. m(_ _)m | |
| // | |
| // Created by daymein gregorio on 2017/08/16. | |
| // Copyright © 2017 daymein gregorio. All rights reserved. | |
| // | |
| import Foundation |
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
| // I always forget how to write this stupid thing | |
| // now I just have to remember I put it here | |
| /// This function calls a closure after a delay. | |
| /// Use it when you want to wait for a certain amount of | |
| /// time before letting an action run | |
| /// | |
| /// - Parameters: | |
| /// - delay: seconds you want to wait | |
| /// - closure: the function you want to run after the delay |
NewerOlder