48 lines
1.1 KiB
Plaintext
48 lines
1.1 KiB
Plaintext
== Why is this an issue?
|
|
|
|
It is often considered good practice at the end of an override to invoke ``++super++``, but there are cases where according to the Apple developer documentation this should not be done.
|
|
|
|
|
|
* ``++updateLayer++`` - optimize the rendering of your view
|
|
* ``++loadView++`` - provide a ``++view++`` when ``++view++`` is ``++nil++``
|
|
* ``++providePlaceholder++`` - provide a placeholder for a document returned by the Document Picker but not yet stored locally
|
|
|
|
In all cases, these are actions that should happen once and only once. Subsequently invoking ``++super++`` would see your desired result replaced (at best) by less specialized results.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,swift]
|
|
----
|
|
class VC: UIMyViewController {
|
|
override func loadView() {
|
|
// ...
|
|
super.loadView()
|
|
}
|
|
}
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,swift]
|
|
----
|
|
class VC: UIMyViewController {
|
|
override func loadView() {
|
|
// ...
|
|
}
|
|
}
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::message.adoc[]
|
|
|
|
include::highlighting.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|