Post not yet marked as solved
Click to stop watching this thread.
You have stopped watching this post. Click to start watching again.
contentPostList.repliesup-voted.tooltip
Update: So I have my Firebase real-time database populated with some data, and I have already integrated Firebase within my app, and the database's structure looks like this:
myDatabase
.
.
. . . Child/node
.
.
.
. . . Child with value of "url"
How do I reference and read the value (the URL) from the database so that the following code uses that URL to open the SFSafariViewController?
Here is the code I use to open the SFSafariViewController using a button tap:
@IBAction func openSFWebView(_ sender: Any) {
guard let url = URL(string: "https://www.google.com")
else {return}
let safariViewController = SFSafariViewController (url: url)
self.present(safariViewController, animated: true, completion: nil)
}
From what I could find online, it seems like I should use observeSingleEventType, but I do not want to have to/don't believe I need to authenticate the user or use the user's ID to access the URL.
Below is from the Firebase documentation:
let newID = Auth.auth().currentUser?.uid (I don't believe I need this.)
ref.child("childName").child(userID!).observeSingleEvent(of: .value, with: { (snapshot) in
// Get user value
let value = snapshot.value as? NSDictionary
let username = value?["username"] as? String ?? ""
let user = User(username: username)
// ...
}) { (error) in
print(error.localizedDescription)
}
Again, I hope someone can help.
Thank You!