KellysOnTop23 KellysOnTop23 - 6 months ago 30
Swift Question

How to save "posts" (not server POST but more like bulletin board) in Firebase for iOS app

So this question is more about the proper way to use Firebase and store data. The user will be given the chance to post (remember not server POST) to other users in the area something that they will read, much like craigslist. I am using Firebase and am unsure oh how to save this information. There will be both a title portion that will be no more then a sentence and then a description portion that I wouldn't want to be outrageously long but still have some depth so the user can take advantage of that.

  • should it be in the database with a key, but if so the documentation tells me that I can't use
    (periods)? (btw how much text would 10mb be?)

  • Should it be in storage and saved as a .txt file that I would then have all the users pull up whenever they check the "post feed" for their area?

I am currently using Facebook authentication and saving their information into the database (except their profile picture which goes into storage).

This is all being done in swift and the newest Firebase with GeoFire as will. Any and all explicit code examples will be helpful as I am still learning. Thank you so much!

Gil Gil

First of all, you should use the real-time database and not the storage service for this type of app. Use the storage for saving things like photos, videos or attachments. As for how to store these "posts" IU n the db, you don't need to worry about special characters since firebase doesn't allow them in the "keys" or node names but you can definitely use them in the values, for example:

"Posts": {
  "some_unique_id_for_post_1" : {
    "Title": "post 1's title",
    "Body": "post 1's text body"

It can get a bit tricky if you try to implement social network type of functionality like "likes", "comments" and "followers" so this might help: