-
Notifications
You must be signed in to change notification settings - Fork 283
[Technical] Marked the "not implemented" initializers as "unavailable" (closes #681) #682
[Technical] Marked the "not implemented" initializers as "unavailable" (closes #681) #682
Conversation
f50b7fa
to
335e9f1
Compare
e51cd9a
to
d3af5a6
Compare
When providing a custom initializer for subclasses of (mostly) UIKit classes conforming to 'NSCoding' the required initializer must be provided by those subclasses. Most of them will never be used and stay with the auto suggestion of Xcode causing a `fatalError`: ``` required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } ``` As this should never be called, I marked those initializers with `available(*, unavailable)`. Calling those initializers will now fail at compile time instead of causing a runtime crash. Additionally, it will stop Xcode suggesting those initializers as code completions.
d3af5a6
to
eb036f8
Compare
@inf2381 I may need your help here (And I saw that it also is a "frequent" issue of some contributors). Do you have any idea how to unblock the issue with (Unfortunately, I didn't work with AFAIK it's happening in this PR as well: #639 |
The issue is on our side, we'll come back to you later this day |
Thanks @inf2381 . |
The issue was that you didn't have access to the context on CircleCI where the access token for SonarCloud is stored. I deleted the context from config.yaml and stored an access key directly in the environment of CircleCI. It seems to be working now 🥳 |
This PR addresses the issue described in #681 .
Description
When providing a custom initializer for subclasses of (mostly) UIKit
classes conforming to 'NSCoding' the required initializer must be
provided by those subclasses.
Most of them will never be used and stay with the auto suggestion
of Xcode causing a
fatalError
:As this should never be called, I marked those initializers
with
available(*, unavailable)
. Calling those initializerswill now fail at compile time instead of causing a
runtime crash.
Additionally, it will stop Xcode suggesting those initializers
as code completions.