Skip to content

Replaced Any uses for workaround with Box#2250

Merged
NachoSoto merged 2 commits into
mainfrom
remove-box-workaround
Feb 7, 2023
Merged

Replaced Any uses for workaround with Box#2250
NachoSoto merged 2 commits into
mainfrom
remove-box-workaround

Conversation

@NachoSoto

@NachoSoto NachoSoto commented Jan 27, 2023

Copy link
Copy Markdown
Contributor

See swiftlang/swift#58099
This is fixed in newer versions of Xcode, but we still need the workaround for older ones. Instead of using Any and force-casting, Box is better since it's type safe.

Other changes:

  • Moved Box to RevenueCat to be able to use the workaround there too.
  • Made Box immutable. It's very dangerous to have a reference value (Box is a class) with reference semantics be mutable. Instead, we force users to have a mutable property instead and re-create the Box, to avoid mutating that data under the hood.
  • Updated the comments to point to the new Swift GitHub issue page.

@NachoSoto NachoSoto requested a review from a team January 27, 2023 17:32
@NachoSoto NachoSoto force-pushed the remove-box-workaround branch from 54fd55b to 25f544c Compare January 27, 2023 17:33
See swiftlang/swift#58099
This is fixed in newer versions of Xcode, but we still need the workaround for older ones. Instead of using `Any` and force-casting, `Box` is better since it's type safe.

I've also updated the comments to point to the new `Swift` GitHub issue page.
@NachoSoto NachoSoto force-pushed the remove-box-workaround branch from 25f544c to 6306add Compare January 27, 2023 17:35
final class Box<T> {

var value: T
let value: T

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ No longer mutable

@codecov

codecov Bot commented Jan 27, 2023

Copy link
Copy Markdown

Codecov Report

Merging #2250 (bda60d3) into main (c765b18) will increase coverage by 0.09%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #2250      +/-   ##
==========================================
+ Coverage   85.90%   85.99%   +0.09%     
==========================================
  Files         183      184       +1     
  Lines       12125    12127       +2     
==========================================
+ Hits        10416    10429      +13     
+ Misses       1709     1698      -11     
Impacted Files Coverage Δ
Sources/Misc/Box.swift 100.00% <ø> (ø)
...chasing/StoreKitAbstractions/SK2StoreProduct.swift 96.72% <100.00%> (ø)
Sources/Logging/Strings/StoreKitStrings.swift 91.17% <0.00%> (+1.47%) ⬆️
Sources/Logging/Strings/NetworkStrings.swift 100.00% <0.00%> (+1.63%) ⬆️
Sources/Networking/HTTPClient/HTTPClient.swift 98.20% <0.00%> (+3.23%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@NachoSoto NachoSoto merged commit cf3090a into main Feb 7, 2023
@NachoSoto NachoSoto deleted the remove-box-workaround branch February 7, 2023 14:51
NachoSoto pushed a commit that referenced this pull request Feb 8, 2023
**This is an automatic release.**

### Dependency Updates
* Bump fastlane-plugin-revenuecat_internal from `738f255` to `9255366`
(#2264) via dependabot[bot] (@dependabot[bot])
* Update `Gemfile.lock` (#2254) via Cesar de la Vega (@vegaro)
### Other Changes
* `HTTPClient`: added support for sending `X-Nonce` (#2214) via
NachoSoto (@NachoSoto)
* `Configuration`: added (`internal` for now) API to load public key
(#2215) via NachoSoto (@NachoSoto)
* Replaced `Any` uses for workaround with `Box` (#2250) via NachoSoto
(@NachoSoto)
* `HTTPClientTests`: fixed failing test with missing assertions (#2262)
via NachoSoto (@NachoSoto)
* `HTTPClientTests`: refactored tests to use `waitUntil` (#2257) via
NachoSoto (@NachoSoto)
* PurchaseTester: Add Receipt Inspector UI (#2249) via Andy Boedo
(@aboedo)
* Adds dependabot (#2259) via Cesar de la Vega (@vegaro)
* `StoreKit1WrapperTests`: avoid using `Bool.random` to fix flaky code
coverage (#2258) via NachoSoto (@NachoSoto)
* `IntroEligibilityCalculator`: changed logic to handle products with no
subscription group (#2247) via NachoSoto (@NachoSoto)
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.

2 participants