parse-community / Parse-Swift

The Swift SDK for Parse Platform (iOS, macOS, watchOS, tvOS, Linux, Android, Windows)
https://parseplatform.org
MIT License
308 stars 69 forks source link

Add discardableResult for certain functions #384

Closed vdkdamian closed 2 years ago

vdkdamian commented 2 years ago

New Feature / Enhancement Checklist

Current Limitation

If you want to execute save() or fetch(),... the function returns the ParseObject. If you don't need it you need to cancel it out with an underscore replacement.

Feature / Enhancement Description

@discardableResult adds the possibility to skip the result as developer. It's up to the developer to decide whether they use the result or not.

Example Use Case

Old use:

let score = GameScore(points: 10)
let savedScore = try await score.save()

or _ = try await score.save()

New use:

let score = GameScore(points: 10)
try await score.save()

or try await score.save()

Alternatives / Workarounds

Currently you need to use a underscore replacement.

parse-github-assistant[bot] commented 2 years ago

Thanks for opening this issue!