@DocumentID var id: String? var title: String var description: String var timstamp: Date } struct ActivityView: View { @State var count = 1 var body: some View { Button { let db = Firestore.firestore() let ref = db.collection("activities") count = count + 1 let now = Date() let activity = Activity(id: nil, title: "\(count)", description: "Activity number \(count)/", timstamp: now) do { let newDocReference = try ref.addDocument(from: activity) print("Book stored with new document reference: \(newDocReference)") } catch { print(error) } } label: { Text("Add Activity") } } }
@DocumentID var id: String? var title: String var description: String var timstamp: Date } struct ActivityView: View { @State var count = 1 var body: some View { Button { let db = Firestore.firestore() let ref = db.collection("activities") count = count + 1 let now = Date() let activity = Activity(id: nil, title: "\(count)", description: "Activity number \(count)/", timstamp: now) do { let newDocReference = try ref.addDocument(from: activity) print("Book stored with new document reference: \(newDocReference)") } catch { print(error) } } label: { Text("Add Activity") } } } ඞཁͳJNQPSU
@DocumentID var id: String? var title: String var description: String var timstamp: Date } struct ActivityView: View { @State var count = 1 var body: some View { Button { let db = Firestore.firestore() let ref = db.collection("activities") count = count + 1 let now = Date() let activity = Activity(id: nil, title: "\(count)", description: "Activity number \(count)/", timstamp: now) do { let newDocReference = try ref.addDocument(from: activity) print("Book stored with new document reference: \(newDocReference)") } catch { print(error) } } label: { Text("Add Activity") } } } σʔλఆٛ
@DocumentID var id: String? var title: String var description: String var timstamp: Date } struct ActivityView: View { @State var count = 1 var body: some View { Button { let db = Firestore.firestore() let ref = db.collection("activities") count = count + 1 let now = Date() let activity = Activity(id: nil, title: "\(count)", description: "Activity number \(count)/", timstamp: now) do { let newDocReference = try ref.addDocument(from: activity) print("Book stored with new document reference: \(newDocReference)") } catch { print(error) } } label: { Text("Add Activity") } } } σʔλΛՃ͢Δ
for your project platform :ios, '14.5' target 'ActivityTest' do # Comment the next line if you don't want to use dynamic frameworks use_frameworks! pod 'Firebase/Auth' pod 'Firebase/Crashlytics' pod 'Firebase/Firestore' pod 'FirebaseFirestoreSwift' pod 'Firebase/Messaging' end
for your project platform :ios, '14.5' target 'ActivityTest' do # Comment the next line if you don't want to use dynamic frameworks use_frameworks! pod 'Firebase/Auth' pod 'Firebase/Crashlytics' pod 'Firebase/Firestore' pod 'FirebaseFirestoreSwift' pod 'Firebase/Messaging' end ೝূ༻ $SBTIMZUJDTू༻ σʔλετΞ༻ ϓογϡ௨༻
App { @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate var body: some Scene { WindowGroup { // original view ContentView() // step1) for Crashlytics activate // CrashView() // step2) for Signin with Apple test // SigninView() // step3) Firestore test // ActivityView() } } }
App { @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate var body: some Scene { WindowGroup { // original view ContentView() // step1) for Crashlytics activate // CrashView() // step2) for Signin with Apple test // SigninView() // step3) Firestore test // ActivityView() } } } $SBTIMZUJDTૄ௨༻ 7JFX 4JHO*OXJUI"QQMF ֬ೝ༻7JFX σʔλετΞ֬ೝ༻7JFX
c.FEJVN w IUUQTNFEJVNDPN fi SFCBTFEFWFMPQFSTNBQQJOH fi SFTUPSFEBUBJOTXJGUUIF DPNQSFIFOTJWFHVJEFBEGC w (JU)VC fi SFCBTFGVODUJPOTTBNQMFT$PMMFDUJPOPGTBNQMFBQQTTIPXDBTJOHQPQVMBSVTF DBTFTVTJOH$MPVE'VODUJPOTGPS'JSFCBTF w IUUQTHJUIVCDPN fi SFCBTFGVODUJPOTTBNQMFT