Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* _Contributing to this repo? Add info about your change here to be included in the next release_

__New features__
- Add toCLLocation and toCLLocationCoordinate2D computed properties to ParseGeoPoint, deprecate toCLLocation() and toCLLocationCoordinate2D() ([#366](https://github.com/parse-community/Parse-Swift/pull/366)), thanks to [Corey Baker](https://github.com/cbaker6).
- Add query computed property to ParseObject ([#365](https://github.com/parse-community/Parse-Swift/pull/365)), thanks to [Corey Baker](https://github.com/cbaker6).
- Add macCatalyst to SPM ([#363](https://github.com/parse-community/Parse-Swift/pull/363)), thanks to [Corey Baker](https://github.com/cbaker6).
- Add includeAll computed property to Query and deprecate includeAll(). Add an order() method to Query that excepts a variadic list as input ([#362](https://github.com/parse-community/Parse-Swift/pull/362)), thanks to [Corey Baker](https://github.com/cbaker6).
Expand Down
6 changes: 3 additions & 3 deletions Sources/ParseSwift/Extensions/Date.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import Foundation

// MARK: Date
internal extension Date {
func parseFormatted() -> String {
return ParseCoding.dateFormatter.string(from: self)
var parseFormatted: String {
ParseCoding.dateFormatter.string(from: self)
}

var parseRepresentation: [String: String] {
return ["__type": "Date", "iso": parseFormatted()]
["__type": "Date", "iso": parseFormatted]
}
}
30 changes: 22 additions & 8 deletions Sources/ParseSwift/Types/ParseGeoPoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,20 @@ extension ParseGeoPoint: CustomStringConvertible {
// MARK: CoreLocation
public extension ParseGeoPoint {

/**
A `CLLocation` instance created from the current `ParseGeoPoint`.
*/
var toCLLocation: CLLocation {
CLLocation(latitude: latitude, longitude: longitude)
}

/**
A `CLLocationCoordinate2D` instance created from the current `ParseGeoPoint`.
*/
var toCLLocationCoordinate2D: CLLocationCoordinate2D {
CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
}

/**
Creates a new `ParseGeoPoint` instance for the given `CLLocation`, set to the location's coordinates.
- parameter location: Instance of `CLLocation`, with set latitude and longitude.
Expand All @@ -168,21 +182,21 @@ public extension ParseGeoPoint {
}

/**
Creates a new `CLLocation` instance for the given `ParseGeoPoint`, set to the location's coordinates.
- parameter geopoint: Instance of `ParseGeoPoint`, with set latitude and longitude.
A `CLLocation` instance created from the current `ParseGeoPoint`.
- returns: Returns a `CLLocation`.
*/
func toCLLocation() -> CLLocation {
CLLocation(latitude: latitude, longitude: longitude)
@available(*, deprecated, message: "Use the computed property instead by removing \"()\"")
func toCLLocation(_ geoPoint: ParseGeoPoint? = nil) -> CLLocation {
toCLLocation
}

/**
Creates a new `CLLocationCoordinate2D` instance for the given `ParseGeoPoint`, set to the location's coordinates.
- parameter geopoint: Instance of `ParseGeoPoint`, with set latitude and longitude.
A `CLLocationCoordinate2D` instance created from the current `ParseGeoPoint`.
- returns: Returns a `CLLocationCoordinate2D`.
*/
func toCLLocationCoordinate2D() -> CLLocationCoordinate2D {
CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
@available(*, deprecated, message: "Use the computed property instead by removing \"()\"")
func toCLLocationCoordinate2D(_ geoPoint: ParseGeoPoint? = nil) -> CLLocationCoordinate2D {
toCLLocationCoordinate2D
}
}
#endif
2 changes: 1 addition & 1 deletion Sources/ParseSwift/Types/Query.swift
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public struct Query<T>: Encodable, Equatable where T: ParseObject {
- warning: This will be removed in ParseSwift 5.0.0 in favor of the `includeAll` computed property.
- returns: The mutated instance of query for easy chaining.
*/
@available(*, deprecated, renamed: "includeAll")
@available(*, deprecated, message: "Use the computed property instead by removing \"()\"")
public func includeAll(_ keys: [String]? = nil) -> Query<T> {
self.includeAll
}
Expand Down