Skip to content

docs: improve documentation sections #276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Nov 8, 2021
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: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
uses: sersoft-gmbh/swift-coverage-action@v2
id: coverage-files
with:
target-name-filter: '^ParseSwift$'
format: lcov
search-paths: ./DerivedData
env:
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@

### main

[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/2.2.2...main)
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/2.2.3...main)
* _Contributing to this repo? Add info about your change here to be included in the next release_

### 2.2.3
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/2.2.2...2.2.3)

__Fixes__
- Improve dpcumentation ([#276](https://github.com/parse-community/Parse-Swift/pull/276)), thanks to [Corey Baker](https://github.com/cbaker6).

### 2.2.2
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/2.2.1...2.2.2)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct GameScore: ParseObject {
var ACL: ParseACL?

//: Your own properties.
var score: Int = 0
var score: Int? = 0
}

//: It's recommended to place custom initializers in an extension
Expand All @@ -45,7 +45,7 @@ do {
savedScore = try GameScore(score: 102).save()
} catch {
savedScore = nil
fatalError("Error saving: \(error)")
assertionFailure("Error saving: \(error)")
}

//: Then we will increment the score.
Expand All @@ -69,8 +69,20 @@ do {
print(error)
}

//: There are other operations: add/remove/delete objects from `ParseObject`s.
//: You can also remove a value for a property using unset.
let unsetOperation = savedScore
.operation.unset(("score", \.score))
do {
let updatedScore = try unsetOperation.save()
print("Updated score: \(updatedScore). Check the new score on Parse Dashboard.")
} catch {
print(error)
}

//: There are other operations: set/forceSet/unset/add/remove, etc. objects from `ParseObject`s.
//: In fact, the `users` and `roles` relations from `ParseRoles` used the add/remove operations.
//: Multiple operations can be chained together. See:
//: https://github.com/parse-community/Parse-Swift/pull/268#issuecomment-955714414
let operations = savedScore.operation

//: Example: operations.add("hello", objects: ["test"]).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation

@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
public extension ParseApple {
// MARK: Login - Async/Await
// MARK: Async/Await

/**
Login a `ParseUser` *asynchronously* using Apple authentication.
Expand Down Expand Up @@ -51,7 +51,6 @@ public extension ParseApple {

@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
public extension ParseApple {
// MARK: Link - Async/Await

/**
Link the *current* `ParseUser` *asynchronously* using Apple authentication.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation
import Combine

public extension ParseApple {
// MARK: Login - Combine
// MARK: Combine

/**
Login a `ParseUser` *asynchronously* using Apple authentication. Publishes when complete.
Expand Down Expand Up @@ -48,7 +48,6 @@ public extension ParseApple {
}

public extension ParseApple {
// MARK: Link - Combine

/**
Link the *current* `ParseUser` *asynchronously* using Apple authentication. Publishes when complete.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation

@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
public extension ParseFacebook {
// MARK: Login - Async/Await
// MARK: Async/Await

/**
Login a `ParseUser` *asynchronously* using Facebook authentication for limited login.
Expand Down Expand Up @@ -75,7 +75,6 @@ public extension ParseFacebook {

@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
public extension ParseFacebook {
// MARK: Link - Async/Await
/**
Link the *current* `ParseUser` *asynchronously* using Facebook authentication for limited login.
- parameter userId: The `userId` from `FacebookSDK`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation
import Combine

public extension ParseFacebook {
// MARK: Login - Combine
// MARK: Combine
/**
Login a `ParseUser` *asynchronously* using Facebook authentication for limited login. Publishes when complete.
- parameter userId: The `userId` from `FacebookSDK`.
Expand Down Expand Up @@ -70,7 +70,6 @@ public extension ParseFacebook {
}

public extension ParseFacebook {
// MARK: Link - Combine
/**
Link the *current* `ParseUser` *asynchronously* using Facebook authentication for limited login.
Publishes when complete.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation

@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
public extension ParseLDAP {
// MARK: Login - Async/Await
// MARK: Async/Await
/**
Login a `ParseUser` *asynchronously* using LDAP authentication.
- parameter id: The id of the `user`.
Expand Down Expand Up @@ -50,7 +50,6 @@ public extension ParseLDAP {

@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
public extension ParseLDAP {
// MARK: Link - Async/Await
/**
Link the *current* `ParseUser` *asynchronously* using LDAP authentication.
- parameter id: The id of the `user`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation
import Combine

public extension ParseLDAP {
// MARK: Login - Combine
// MARK: Combine
/**
Login a `ParseUser` *asynchronously* using LDAP authentication. Publishes when complete.
- parameter id: The id of the `user`.
Expand Down Expand Up @@ -47,7 +47,6 @@ public extension ParseLDAP {
}

public extension ParseLDAP {
// MARK: Link - Combine
/**
Link the *current* `ParseUser` *asynchronously* using LDAP authentication. Publishes when complete.
- parameter id: The id of the `user`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation

@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
public extension ParseTwitter {
// MARK: Login - Async/Await
// MARK: Async/Await

/**
Login a `ParseUser` *asynchronously* using Twitter authentication.
Expand Down Expand Up @@ -63,7 +63,6 @@ public extension ParseTwitter {

@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
public extension ParseTwitter {
// MARK: Link - Async/Await

/**
Link the *current* `ParseUser` *asynchronously* using Twitter authentication.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation
import Combine

public extension ParseTwitter {
// MARK: Login - Combine
// MARK: Combine

/**
Login a `ParseUser` *asynchronously* using Twitter authentication. Publishes when complete.
Expand Down Expand Up @@ -60,7 +60,6 @@ public extension ParseTwitter {
}

public extension ParseTwitter {
// MARK: Link - Combine

/**
Link the *current* `ParseUser` *asynchronously* using Twitter authentication. Publishes when complete.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ import Foundation
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
public extension ParseAnonymous {

// MARK: Login - Async/Await
// MARK: Async/Await
/**
Login a `ParseUser` *asynchronously* using the respective authentication type.
- parameter options: A set of header options sent to the server. Defaults to an empty set.
- parameter callbackQueue: The queue to return to after completion. Default value of .main.
- returns: An instance of the logged in `ParseUser`.
- throws: `ParseError`.
*/
Expand All @@ -31,7 +30,6 @@ public extension ParseAnonymous {
Login a `ParseUser` *asynchronously* using the respective authentication type.
- parameter authData: The authData for the respective authentication type. This will be ignored.
- parameter options: A set of header options sent to the server. Defaults to an empty set.
- parameter callbackQueue: The queue to return to after completion. Default value of .main.
- returns: An instance of the logged in `ParseUser`.
- throws: `ParseError`.
*/
Expand All @@ -48,7 +46,6 @@ public extension ParseAnonymous {
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
public extension ParseAnonymous {

// MARK: Link - Async/Await
func link(authData: [String: String],
options: API.Options = []) async throws -> AuthenticatedUser {
try await withCheckedThrowingContinuation { continuation in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public extension ParseAnonymous {

public extension ParseAnonymous {

// MARK: Link - Combine
func linkPublisher(authData: [String: String],
options: API.Options = []) -> Future<AuthenticatedUser, ParseError> {
Future { promise in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public extension ParseAnonymous {
func login(authData: [String: String],
options: API.Options = []) throws -> AuthenticatedUser {
try AuthenticatedUser.login(__type,
authData: AuthenticationKeys.id.makeDictionary(),
authData: authData,
options: options)
}

Expand Down Expand Up @@ -96,7 +96,7 @@ public extension ParseAnonymous {
callbackQueue: DispatchQueue = .main,
completion: @escaping (Result<AuthenticatedUser, ParseError>) -> Void) {
AuthenticatedUser.login(__type,
authData: AuthenticationKeys.id.makeDictionary(),
authData: authData,
options: options,
callbackQueue: callbackQueue,
completion: completion)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ public extension ParseUser {
completion: promise)
}
}

}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ public protocol ParseAuthentication: Codable {
func strip(_ user: AuthenticatedUser) -> AuthenticatedUser

#if canImport(Combine)
// MARK: Combine
/**
Login a `ParseUser` *asynchronously* using the respective authentication type.
Login a `ParseUser` *asynchronously* using the respective authentication type. Publishes when complete.
- parameter authData: The authData for the respective authentication type.
- parameter options: A set of header options sent to the server. Defaults to an empty set.
- parameter callbackQueue: The queue to return to after completion. Default value of .main.
Expand All @@ -107,7 +108,7 @@ public protocol ParseAuthentication: Codable {
options: API.Options) -> Future<AuthenticatedUser, ParseError>

/**
Link the *current* `ParseUser` *asynchronously* using the respective authentication type.
Link the *current* `ParseUser` *asynchronously* using the respective authentication type. Publishes when complete.
- parameter authData: The authData for the respective authentication type.
- parameter options: A set of header options sent to the server. Defaults to an empty set.
- parameter callbackQueue: The queue to return to after completion. Default value of .main.
Expand All @@ -117,7 +118,7 @@ public protocol ParseAuthentication: Codable {
options: API.Options) -> Future<AuthenticatedUser, ParseError>

/**
Unlink the `ParseUser` *asynchronously* from the respective authentication type.
Unlink the `ParseUser` *asynchronously* from the respective authentication type. Publishes when complete.
- parameter user: The `ParseUser` to unlink. The user must be logged in on this device.
- parameter options: A set of header options sent to the server. Defaults to an empty set.
- parameter callbackQueue: The queue to return to after completion. Default value of .main.
Expand All @@ -127,14 +128,45 @@ public protocol ParseAuthentication: Codable {
func unlinkPublisher(_ user: AuthenticatedUser,
options: API.Options) -> Future<AuthenticatedUser, ParseError>

/**
Unlink the *current* `ParseUser` *asynchronously* from the respective authentication type. Publishes when complete.
- parameter options: A set of header options sent to the server. Defaults to an empty set.
- returns: A publisher that eventually produces a single value and then finishes or fails.
*/
func unlinkPublisher(options: API.Options) -> Future<AuthenticatedUser, ParseError>
#endif

#if swift(>=5.5) && canImport(_Concurrency)
// MARK: Async/Await

/**
Link the *current* `ParseUser` *asynchronously* using the respective authentication type.
- parameter authData: The authData for the respective authentication type.
- parameter options: A set of header options sent to the server. Defaults to an empty set.
- parameter returns: An instance of the linked `AuthenticatedUser`.
*/
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
func link(authData: [String: String],
options: API.Options) async throws -> AuthenticatedUser

/**
Unlink the `ParseUser` *asynchronously* from the respective authentication type.
- parameter user: The `ParseUser` to unlink. The user must be logged in on this device.
- parameter options: A set of header options sent to the server. Defaults to an empty set.
- parameter returns: An instance of the unlinked `AuthenticatedUser`.
*/
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
func unlink(_ user: AuthenticatedUser,
options: API.Options) async throws -> AuthenticatedUser

/**
Unlink the *current* `ParseUser` *asynchronously* from the respective authentication type.
- parameter options: A set of header options sent to the server. Defaults to an empty set.
- parameter callbackQueue: The queue to return to after completion. Default value of .main.
- parameter completion: The block to execute.
It should have the following argument signature: `(Result<Self, ParseError>)`.
- parameter returns: An instance of the unlinked `AuthenticatedUser`.
*/
func unlinkPublisher(options: API.Options) -> Future<AuthenticatedUser, ParseError>
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
func unlink(options: API.Options) async throws -> AuthenticatedUser
#endif
}

Expand Down
5 changes: 1 addition & 4 deletions Sources/ParseSwift/Objects/ParseInstallation+async.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Foundation
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
public extension ParseInstallation {

// MARK: Fetchable - Async/Await
// MARK: Async/Await
/**
Fetches the `ParseInstallation` *aynchronously* with the current data from the server
and sets an error if one occurs. Publishes when complete.
Expand All @@ -35,7 +35,6 @@ public extension ParseInstallation {
}
}

// MARK: Savable - Async/Await
/**
Saves the `ParseInstallation` *asynchronously*.
- parameter isIgnoreCustomObjectIdConfig: Ignore checking for `objectId`
Expand All @@ -55,7 +54,6 @@ public extension ParseInstallation {
}
}

// MARK: Deletable - Async/Await
/**
Deletes the `ParseInstallation` *asynchronously*.

Expand All @@ -71,7 +69,6 @@ public extension ParseInstallation {
}
}

// MARK: Batch Support - Async/Await
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
public extension Sequence where Element: ParseInstallation {
/**
Expand Down
1 change: 0 additions & 1 deletion Sources/ParseSwift/Objects/ParseInstallation+combine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public extension ParseInstallation {
}
}

// MARK: Batch Support - Combine
public extension Sequence where Element: ParseInstallation {
/**
Fetches a collection of installations *aynchronously* with the current data from the server and sets
Expand Down
1 change: 0 additions & 1 deletion Sources/ParseSwift/Objects/ParseObject+async.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public extension ParseObject {

@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
public extension Sequence where Element: ParseObject {
// MARK: Batch Support - Async/Await
/**
Fetches a collection of objects *aynchronously* with the current data from the server and sets
an error if one occurs.
Expand Down
1 change: 0 additions & 1 deletion Sources/ParseSwift/Objects/ParseObject+combine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public extension ParseObject {
}

public extension Sequence where Element: ParseObject {
// MARK: Batch Support - Combine
/**
Fetches a collection of objects *aynchronously* with the current data from the server and sets
an error if one occurs. Publishes when complete.
Expand Down
Loading