Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
486 views
in Technique[技术] by (71.8m points)

swift - How do I design a simple Firebase Database that stores arrays?

I am in the midst of coding an IOS application using Xcode 8.2.1 in Swift. Currently, I have the database set up for one view controller that implements GeoFire and successfully adds locations to the database. On a separate view controller, I want to add a reference to the same database and add children to this reference.

This separate reference I want to store different arrays that can be accessed by the array name. I want to be able to add and remove the saved arrays in the database. In addition, I want to be able to add and remove the strings that are held in each individual array.

The code that I have tried is:

    let ref = FIRDatabase.database().reference()

    let childRef = FIRDatabase.database().reference(withPath: "arrays")

    let itemsRef = ref.child("arrays")

    let milkRef = itemsRef.child("array1")

But when I run this code, the database does not update to show any new children. Is it possible to accomplish my task? If so, what am I doing wrong?

If my question is unclear in any way please let me know and I will be willing to elaborate. Thank you in advance for any help!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...