Giter Club home page Giter Club logo

geofirex-swift's Introduction

GeoFireX-Swift

CI Status Version License Platform

This framework helps you to get geometry data from Firebase with geohash. Basic logic is the same as GeoFireX by codediodeio.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

GeoFireX-Swift query result is returned as Combine, so you have to make a subscriber to get result. within() makes Publisher, you can make a subscriber just by executing sink().

import Firebase
import Combine
import GeoFireX_Swift

let client = GeoFireClient()
let query = client.query("markers")
let center = FirePoint(geopoint: GeoPoint(latitude: 35.68123620000001, longitude: 139.7671248))

var result : [[String:Any]]!

let subscriber = query.within(center: center, radius: 1.5, field: "geography", opts: GeoQueryOptions(units: .kilometer, log: true))?.sink( receiveCompletion: { completion in
  switch completion {
  case .finished:
    print(".sink() received the completion:", String(describing: completion))
    break
  case .failure(let anError):
    print("received the error: ", anError)
    break
  }
}) { (dataList) in
  result = dataList
}

Requirements

  • iOS 13.0 later
  • Conbine
  • Firebase

Installation

GeoFireX-Swift is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'GeoFireX-Swift'

Run UnitTest

You have to setup Firebase emulator to invoke Unit Test. Official guide is here.

Setup Steps

1. install firebase-tool

$ npm install -g firebase-tools

2. install Firebase emulatoer

$ firebase setup:emulators:firestore

3. move firebase configuration directory

$ mv firebase

4. start emulator

$ firebase emulators:start --only firestore

5. run Unit Tests

Features

Not implemented yet

  • Promise Binding
  • Converting result to JSON

Author

Nob, Twitter Portfolio

License

GeoFireX-Swift is available under the MIT license. See the LICENSE file for more info.

geofirex-swift's People

Contributors

nob3rise avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.