summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMax Schumacher <maximilianbschumacher@gmail.com>2020-10-20 12:44:33 +0200
committerGitHub <noreply@github.com>2020-10-20 12:44:33 +0200
commita4b801fcb3ee4e06fb101b61882f6082783ee3a1 (patch)
treeaf0dd384114196a65bd36d7da88c1e3b484b0b77
parent8024d3f9756a481b5a405c87fcfbec7c58ea619e (diff)
parent8a54e8b738ab32f5e968e39929a0bd86e0d78aa2 (diff)
Merge pull request #4040 from mofarajmandi/patch-1
Add a short note about `final` keyword
-rw-r--r--swift.html.markdown11
1 files changed, 11 insertions, 0 deletions
diff --git a/swift.html.markdown b/swift.html.markdown
index 689c5191..3981a4ce 100644
--- a/swift.html.markdown
+++ b/swift.html.markdown
@@ -822,6 +822,17 @@ for _ in 0..<10 {
See more here: https://docs.swift.org/swift-book/LanguageGuide/AccessControl.html
*/
+// MARK: Preventing Overrides
+
+// You can add keyword `final` before a class or instance method, or a property to prevent it from being overridden
+class Shape {
+ final var finalInteger = 10
+}
+
+// Prevent a class from being subclassed
+final class ViewManager {
+}
+
// MARK: Conditional Compilation, Compile-Time Diagnostics, & Availability Conditions
// Conditional Compilation