diff options
Diffstat (limited to 'swift.html.markdown')
-rw-r--r-- | swift.html.markdown | 11 |
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 |