Swift - Snippets
Aus Wikizone
Links
Swift (Programmiersprache) https://www.swift.org/
Random / Range
Mit Random erzeugt man Zufallszahlen. Mit dem Range Operator kann man Zahlenbereiche definieren.
let score = Int.random(in: 1...10) let rating = Int.random(in: 1..<10) let floatNumber = Float.random(in: 1...10) let bool = Bool.random(in: 1...10)
Time
Swift - delay code execution
Sound
Swift - Play a Sound
Gestures and Motions
Swift - Shake Motion
String Manipulation
Swift - get file extension Swift - Strings als Double validieren
Farben
UIColor Erweiterung für Hexadezimalwerte
Extensions
Swift - View Extensions