Skip to content

Instantly share code, notes, and snippets.

View tinder-garricnahapetian's full-sized avatar

Garric Nahapetian tinder-garricnahapetian

  • Tinder
View GitHub Profile
import Foundation
struct KeepsOrder: Codable {
let name: String
let order: [Int]
init(name: String) {
self.name = name
order = [1,2,3,4,5].shuffled()
let string = "one"
switch string {
case _ where string.contains("one"):
break
case _ where string.contains("two"):
break
default:
break
}
func clearItems() {
// clear items
}
func reloadItems(_ clearItems: (() -> Void)? = nil) {
if let _ = clearItems?() { // This will execute the closure if it is not nil and bind its return to _.
// Dome something if caller wants to clear items
}