Improve progress updating, fix warnings
This commit is contained in:
32
Caps/Preview Content/Database+Mock.swift
Normal file
32
Caps/Preview Content/Database+Mock.swift
Normal file
@@ -0,0 +1,32 @@
|
||||
import UIKit
|
||||
|
||||
extension Database {
|
||||
|
||||
static var mock: Database {
|
||||
let caps = [
|
||||
Cap(id: 123, name: "My new cap"),
|
||||
Cap(id: 234, name: "My favorite cap"),
|
||||
Cap(id: 345, name: "My oldest cap"),
|
||||
Cap(id: 456, name: "My new cap"),
|
||||
Cap(id: 567, name: "My favorite cap"),
|
||||
Cap(id: 678, name: "My oldest cap"),
|
||||
].reduce(into: [:]) { $0[$1.id] = $1 }
|
||||
|
||||
let db = Database(caps: caps)
|
||||
db.serverPath = "https://caps.christophhagen.de"
|
||||
|
||||
db.image = UIImage(systemSymbol: .photo)
|
||||
return db
|
||||
}
|
||||
|
||||
static var largeMock: Database {
|
||||
let caps = (1..<500)
|
||||
.map { Cap(id: $0, name: "Cap \($0)") }
|
||||
.reduce(into: [:]) { $0[$1.id] = $1 }
|
||||
|
||||
let db = Database(caps: caps)
|
||||
db.serverPath = "https://caps.christophhagen.de"
|
||||
db.image = UIImage(systemSymbol: .photo)
|
||||
return db
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user