- Use an iPod or an iPad without a SIM card
- Use an iPhone
- Do not jailbreak
- Always upgrade to new iOS versions
- Use Brave browser
This file contains 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
extension Array { | |
func first() -> Element? { | |
if isEmpty { | |
return nil | |
} | |
return self[0] | |
} | |
func last() -> Element? { |
This file contains 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
// | |
// Set | |
// | |
struct MySet<KeyType : Hashable> : Sequence | |
{ | |
var dictionaryOfItems = Dictionary<KeyType,Bool>() | |
init() {} | |
init(array:Array<KeyType>) { |
This file contains 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 Swift | |
struct SetGenerator<T : Hashable> : Generator { | |
var dictGenerator : DictionaryGenerator<T, Void> | |
init(_ d : Dictionary<T,Void>) { | |
dictGenerator = d.generate() | |
} | |
This file contains 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
struct MySet<KeyType : Hashable> : Sequence, ArrayLiteralConvertible | |
{ | |
var dictionaryOfItems = Dictionary<KeyType,Bool>() | |
typealias GeneratorType = MapSequenceGenerator<Dictionary<KeyType, Bool>.GeneratorType, KeyType> | |
init() {} | |
init(array: KeyType[]) { | |
for item in array { | |
self.dictionaryOfItems.updateValue(true, forKey: item) | |
} |
This file contains 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
// | |
// JAZMusician.h | |
// JazzyApp | |
// | |
#import <Foundation/Foundation.h> | |
/** | |
JAZMusician models, you guessed it... Jazz Musicians! | |
From Ellington to Marsalis, this class has you covered. |
This file contains 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
// See: https://devforums.apple.com/message/1000934#1000934 | |
import Foundation | |
// Logic | |
operator prefix ¬ {} | |
@prefix func ¬ (value: Bool) -> Bool { | |
return !value | |
} |
This file contains 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
// Given array of 2-tuples, return two arrays | |
func unzip<T, U>(array: [(T, U)]) -> ([T], [U]) { | |
var t = Array<T>() | |
var u = Array<U>() | |
for (a, b) in array { | |
t.append(a) | |
u.append(b) | |
} | |
return (t, u) | |
} |