Skip to content

1.4.0

Compare
Choose a tag to compare
@benlmyers benlmyers released this 18 Sep 10:28
· 16 commits to main since this release
0cca07b

🎉 Thank you for supporting EasyFirebase! I'm a full-time student spending my free time on this library, so I apologize if there any bugs present. Feel free to contribute with a pull request or report buts in Issues!

New Features

Built-In Geo-Querying

Geohashing and querying is built-in now with EasyFirebase. Conform your document type to GeoQueryable to unlock geo-querying capabilities for your documents.

class MyDocument: Document, GeoQueryable {
  static var geohashPrecision: GeoPrecision = .normal
  @objc var geohash: String = ""
  var latitude: Double
  var longitude: Double
  ...
}

// Works if myDocument.latitude and myDocument.longitude are non-nil
myDocument.updateGeohash()

// Query nearby documents
EasyFirestore.Querying.near(\MyDocument.geohash, at: location, precision: .loose, order: .ascending) { documents in
  ...
}

EasyLink Support

Create a Firebase Dynamic Link using EasyLink:

EasyLink.urlPrefix = "company.page.link"
EasyLink.backupURL = URL(string: "https://www.mycompany.com")
var link = EasyLink(host: "mycompany.com", query: ("foodID", food.id))
link.shorten { shortURL in ... }

Handle a universal URL using EasyLink to retrieve the deep-link payload:

EasyLink.handle(handledURL) { easyLink in
  guard let easyLink = easyLink else { return }
  if let id: String = easyLink.query["foodID"] { ... }
}

Pass in social parameters:

link.social = .init(title: "My Food", desc: "Check out this awesome meal.", imageURL: foodImageURL)

Firestore Map Updating

Update the value of a field in a map in a field in a document in Firestore:

EasyFirestore.Updating.updateMapValue(key: "Barry", value: 25, to: \.friends, in: global.user) { error in ... }

Remove a similar value:

EasyFirestore.Updating.removeMapValue(key: "Barry", from: \.friends, in: global.user) { error in ... }

EasyMessaging Improvements

It's easier to define the type of information you wish to display in a MessagingNotification. A new initializer provides explicit control over a remote notification's title, body, and other information:

let notification = MessagingNotification(title: "Hello, world!", body: "It's a great, sunny day. Fizzbuzz! 🐝", from: global.user, in: "general")

Minor Changes

  • New Session Errors: .endError, .alreadyHost, .notInSession, .alreadyInSession provide additional session warnings.
  • The onUpdate callback of EasyFirestore.Listening.listen(...) will be called passing nil if no data can be found for a document.
  • Added a simple EasyFirestore.Updating demonstration to the Example Project.

Bug Fixes