TutorialSeeder.swift (754B)
1 import Foundation 2 3 @MainActor 4 enum TutorialSeeder { 5 static func seed(store: ItemStore) { 6 let titles = [ 7 "Swipe right to complete", 8 "Swipe left to delete", 9 "Long press and drag to reorder", 10 "Tap the text to edit", 11 "Pull down to create", 12 "Or tap below to create", 13 "Pull up to clear completed", 14 ] 15 16 for (index, title) in titles.enumerated() { 17 do { 18 _ = try store.createItem( 19 title: title, 20 sortOrder: Int64(index) * 1000 21 ) 22 } catch { 23 continue 24 } 25 } 26 27 do { 28 try store.save() 29 } catch {} 30 } 31 }