id: 12704    nodeId: 12704    type: General    point: 99.0    linkPoint: 2.0    maker: cella    permission: linkable    made at: 2020.03.24 05:09    edited at: 2021.08.23 08:28
reader-writer iOS app development with Firebase
20210621

기존의 AWS 서버를 이용하여 LAMP 방식을 사용할까 하다가 요새는 앱 개발에 Firebase를 많이 사용한다고 하여 그것을 써 보기로 한다.
초반에 사용자가 적을 때는 free라고 한다.
특히 authentication을 위해서 email 뿐 아니라 phone SMS 방식을 지원하기 때문에 사용자 편의성이 높다.

20210622

Firebase에서 제공하는 DB 중에서 Realtime Database와 Cloud Firestore가 있는데, Realtime Database가 약간 더 빠른 듯(?)하고
read-write 횟수가 아니라 용량에 따라 과금하기 때문에 본 프로젝트같은 text 위주의 contents에서는 더 유리할 듯 하지만
복잡한 query를 사용할 수 없다는 것, JSON 방식으로서 child node 개수가 많아지면 시간 지연이 심해진다는 점,
DB가 커지면 저절로 스케일링되는 게 아니라 샤딩(?)을 해 줘야한다는 점, 등등 단점이 많은 듯 하다.
아마 이러한 단점들 때문에 Cloud Firestore가 새로 개발된 것 같다. 그래서 Cloud Firestore를 사용하기로 한다.

20210625

Cloud Firestore 공부 중이다.

20210727

Firebase Authentication
https://www.youtube.com/watch?v=1HN7usMROt8
navigation in SwiftUI
https://sarunw.com/posts/navigation-in-swiftui/
https://www.hackingwithswift.com/articles/216/complete-guide-to-navigationview-in-swiftui
The following tutorial is helpful.
https://benmcmahen.com/authentication-with-swiftui-and-firebase/
But this is in old version of Swift. It should be modified a little as follows.
https://stackoverflow.com/questions/57650890/swiftui-firebase-authentication-environmental-object-doesnt-update-on-sign
another firebase tutorial:
Firebase Tutorial: Getting Started
Learn Firebase fundamentals including saving data, real-time sync, authentication, user status and offline support.
https://www.raywenderlich.com/21133526-firebase-tutorial-getting-started
swift 공부할 필요.


@StateObject, @ObservedObject, @EnvironmentObject in Swift
https://www.hackingwithswift.com/quick-start/swiftui/how-to-use-observedobject-to-manage-state-from-external-objects
SwiftUI는 iOS 14부터 AppDelegate, SceneDelegate 를 사용하지 않는다고 함.
(그런데 위 예들은 AppDelegate를 사용하고 있음.)
어떻게 바뀌었는지 정리한 글.
https://betterprogramming.pub/swiftuis-new-app-lifecycle-and-replacements-for-appdelegate-and-scenedelegate-in-ios-14-c9cf4a2367a9
Firebase 를 swift 에서 사용하는 기존 방식은 AppDelegate 를 사용한다.
새로운 방식들:
https://stackoverflow.com/questions/62626652/where-to-configure-firebase-in-my-ios-app-in-the-new-swiftui-app-life-cycle-with
결국 firebase homepage 를 참고하는 게 제일 좋을 듯.
https://firebase.google.com/docs/auth/ios/start
--------------
Finally
--------------

1. Add Firebase to iOS project
https://www.treeofwords.com/walu/AccessMonad?i=12707

2. Sample iOS project with Firebase

3. enable sign-in method in Firebase console
select Authentication > Sign-in method > enable "email/password" or etc.

4. sign up in iOS device
check in Firebase console
select Authentication > Users
You can see that there is a new user just signed up.


----------------
Firestore
----------------
https://firebase.google.com/docs/firestore/quickstart#ios

Return to reader-writer iOS app development with Firebase