-
Notifications
You must be signed in to change notification settings - Fork 292
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
Enable explicit_init lint rule and fix issues #3418
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this! 👏🏻
@@ -75,7 +75,7 @@ private extension StoreProductDiscount.PaymentMode { | |||
case .freeTrial: | |||
self = .freeTrial | |||
@unknown default: | |||
Logger.appleWarning(Strings.storeKit.skunknown_payment_mode(String.init(describing: paymentMode))) | |||
Logger.appleWarning(Strings.storeKit.skunknown_payment_mode(.init(describing: paymentMode))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do
Logger.appleWarning(Strings.storeKit.skunknown_payment_mode(.init(describing: paymentMode))) | |
Logger.appleWarning(Strings.storeKit.skunknown_payment_mode(paymentMode.rawValue)) |
That doesn't use reflection so it's a lot faster
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly it's a UInt
enum :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then String(enum.rawValue)
. Describing uses runtime reflection and it's A LOT slower.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You already merged so it's fine. It was already like this anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And it's not like this is a hot path.
@@ -60,7 +60,7 @@ private extension StoreProductDiscount.PaymentMode { | |||
case .freeTrial: | |||
self = .freeTrial | |||
default: | |||
Logger.appleWarning(Strings.storeKit.skunknown_payment_mode(String.init(describing: paymentMode))) | |||
Logger.appleWarning(Strings.storeKit.skunknown_payment_mode(.init(describing: paymentMode))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #3418 +/- ##
=======================================
Coverage 86.07% 86.07%
=======================================
Files 237 237
Lines 17201 17201
=======================================
Hits 14805 14805
Misses 2396 2396 ☔ View full report in Codecov by Sentry. |
**This is an automatic release.** ### RevenueCatUI * Paywalls: Fix navigation with close button in UIKit (#3466) via Andy Boedo (@aboedo) * `Paywalls`: `watchOS` support (#3291) via NachoSoto (@NachoSoto) ### Dependency Updates * Bump cocoapods from 1.14.2 to 1.14.3 (#3464) via dependabot[bot] (@dependabot[bot]) * Bump fastlane from 2.216.0 to 2.217.0 (#3415) via dependabot[bot] (@dependabot[bot]) * Bump danger from 9.3.2 to 9.4.0 (#3414) via dependabot[bot] (@dependabot[bot]) ### Other Changes * Some `APITester` fixes (#3444) via NachoSoto (@NachoSoto) * `HTTPClient`: test all request headers (#3425) via NachoSoto (@NachoSoto) * `CircleCI`: fix snapshot generation for iOS 14 (#3431) via NachoSoto (@NachoSoto) * Remove `MockStoreMessagesHelper` from SDK (#3417) via NachoSoto (@NachoSoto) * Enable explicit_init lint rule and fix issues (#3418) via Mark Villacampa (@MarkVillacampa)
This rule will warn when calling
init
with the explicit type where it can be inferred, or where the.init
part can be omitted.