場所に基づいてFirebaseデータをフィルタリングするためにGeoFireを使用する予定です。私が開発を始めたばかりなので、これをどうやって始めたらよいかわかりません。別の「ユーザー」クラスのジオファイアとスウィフト
@IBAction func shareDidTap(_ sender: Any) {
if let image = image, let caption = textView.text {
let newMedia = Media(type: "image", caption: caption, createdBy: user, image: image)
newMedia.save(completion: { (error) in
if let error = error {
self.alert(title: "Oops!", message: error.localizedDescription, buttonTitle: "OK")
} else {
self.user.share(newMedia: newMedia)
(MVC)私はインスタンス化しません
func share(newMedia: Media) {
DatabaseReference.users(uid: uid).reference().child("media").childByAutoId().setValue(newMedia.uid)
}
でFirebaseにそれを保存します。私は、私は1つのクラスにおいて作成PICやキャプションなどを持っていますGeoFireリファレンス?自分のLatとLonを取得するためにCore Locationを使用する必要がありますか?どんな助けもありがとう。ありがとうございました。 その後pod 'GeoFire', :git => 'https://github.com/firebase/geofire-objc.git'
がimport GeoFire
は、現在のユーザの位置を取得するには
let rootRef = Database.database().reference()
let geoRef = GeoFire(firebaseRef: rootRef.child("user_locations"))
を使用して、それへの参照を作成して投影するインポートポッドで