Skip to content

feat: make "current" ParseObjects immutable #266

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 2 commits into from
Oct 30, 2021
Merged

feat: make "current" ParseObjects immutable #266

merged 2 commits into from
Oct 30, 2021

Conversation

cbaker6
Copy link
Contributor

@cbaker6 cbaker6 commented Oct 28, 2021

New Pull Request Checklist

Issue Description

Currently all objects can be set through current, like: ParseUser.current, ParseInstallation.current, ParseConfig.current. These should be mutable and when the developer wants to mutate, they make mutable copies. This prevents setting to nil directly as current should only happen when using the logout method.

Related issue: #267

Approach

Make all current properties internally set to the SDK.

All playgrounds examples have shown how to make mutable copies instead of setting current directly for some time now. Many people learn how to use the SDK from the Swift playground examples.

TODOs before merging

  • Make sure all test cases pass
  • Verify everything works in Swift Playgrounds
  • Improve/remove force unwrapping in ParseACL
  • Improved comments in SDK
  • Add entry to changelog

@parse-github-assistant
Copy link

parse-github-assistant bot commented Oct 28, 2021

Thanks for opening this pull request!

  • 🎉 We are excited about your hands-on contribution!

@codecov
Copy link

codecov bot commented Oct 28, 2021

Codecov Report

Merging #266 (91ab18a) into main (5860abd) will decrease coverage by 0.00%.
The diff coverage is 88.88%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #266      +/-   ##
==========================================
- Coverage   82.33%   82.32%   -0.01%     
==========================================
  Files          99       99              
  Lines       10512    10512              
==========================================
- Hits         8655     8654       -1     
- Misses       1857     1858       +1     
Impacted Files Coverage Δ
Sources/ParseSwift/Objects/ParseInstallation.swift 77.36% <ø> (ø)
Sources/ParseSwift/Types/ParseConfig.swift 97.05% <ø> (ø)
Sources/ParseSwift/Types/ParseACL.swift 86.30% <87.50%> (ø)
Sources/ParseSwift/Objects/ParseUser.swift 79.85% <100.00%> (+0.21%) ⬆️
Sources/ParseSwift/Objects/ParseObject.swift 74.57% <0.00%> (-0.57%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5860abd...91ab18a. Read the comment docs.

@cbaker6 cbaker6 linked an issue Oct 28, 2021 that may be closed by this pull request
3 tasks
@cbaker6 cbaker6 merged commit 126f4f6 into main Oct 30, 2021
@cbaker6 cbaker6 deleted the immutableCurrent branch October 30, 2021 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"current" ParseObjects should be immutable
1 participant