Developed without a storyboard.

For example, but

There are view A and view B, and transition from A to B.

In view A, the Firestore snapshot references the data "hoge" and passes the value to UILabel.

I'd like to pass the data "hoge" to UILabel even in view B.
By passing a value from view A to B with a bucket relay, you can receive data "hoge".

I want to hear

I don't know the database yet, so I would like to ask you about it.
Will this bucket relay save you database traffic?

If i use snapshots in view B, you can definitely refer to the data in the firestore, but if you refer to this once in view C or view D, it will put pressure on the database communication. Do I want

Data"hoge"is important data, and it seems to be safe to refer to it because it will be difficult if the data changes because an error occurs at the bucket relay.

I'd like to know what i am actually using.

  • Answer # 1

    If you always want to use the latest value stored in the DB on any screen, you should refer to the Firestore data directly.

    Firestore has a cache function, so even if you set multiple listeners for the same query, there is no pressure on the communication.

    If View B is a screen for editing the data displayed in View A, it is not necessary to update the data without permission during editing. In that case, it is appropriate to pass in the bucket relay. think.