标签:format default line rar dealloc isp operation declare automatic
Declaration modifiers are keywords or context-sensitive keywords that modify the behavior or meaning of a declaration. You specify a declaration modifier by writing the appropriate keyword or context-sensitive keyword between a declaration’s attributes (if any) and the keyword that introduces the declaration.
classfinal modifier can be overridden by subclasses.dynamicApply this modifier to any member of a class that can be represented by Objective-C. When you mark a member declaration with the dynamic modifier, access to that member is always dynamically dispatched using the Objective-C runtime. Access to that member is never inlined or devirtualized by the compiler.
Because declarations marked with the dynamic modifier are dispatched using the Objective-C runtime, they must be marked with the objc attribute.
finalfinal attribute, see Preventing Overrides.lazylazy modifier, see Lazy Stored Properties.optionalApply this modifier to a protocol’s property, method, or subscript members to indicate that a conforming type isn’t required to implement those members.
You can apply the optional modifier only to protocols that are marked with the objcattribute. As a result, only class types can adopt and conform to a protocol that contains optional member requirements. For more information about how to use the optionalmodifier and for guidance about how to access optional protocol members—for example, when you’re not sure whether a conforming type implements them—see Optional Protocol Requirements.
requiredrequired modifier.staticstatic modifier on a member declaration has the same effect as writing the class and final modifiers on that member declaration. However, constant type properties of a class are an exception: static has its normal, nonclass meaning there because you can’t write class or final on those declarations.unownedunowned modifier, see Unowned References.unowned(safe)unowned.unowned(unsafe)unowned modifier, see Unowned References.weaknil. For an example and more information about the weak modifier, see Weak References.Swift provides five levels of access control: open, public, internal, file private, and private. You can mark a declaration with one of the access-level modifiers below to specify the declaration’s access level. Access control is discussed in detail in Access Control.
openopen access-level modifier can also be accessed and subclassed by code in a module that imports the module that contains that declaration.publicpublic access-level modifier can also be accessed (but not subclassed) by code in a module that imports the module that contains that declaration.internalinternal access-level modifier.fileprivateprivateFor the purpose of access control, extensions to the same type that are in the same file share an access-control scope. If the type they extend is also in the same file, they share the type’s access-control scope. Private members declared in the type’s declaration can be accessed from extensions, and private members declared in one extension can be accessed from other extensions and from the type’s declaration.
Each access-level modifier above optionally accepts a single argument, which consists of the set keyword enclosed in parentheses (for example, private(set)). Use this form of an access-level modifier when you want to specify an access level for the setter of a variable or subscript that’s less than or equal to the access level of the variable or subscript itself, as discussed in Getters and Setters.
GRAMMAR OF A DECLARATION MODIFIER
declaration-modifier → class | convenience | dynamic | final | infix | lazy | optional | override | postfix | prefix | required | static | unowned | unowned ( safe ) | unowned( unsafe ) | weak
declaration-modifier → access-level-modifier
declaration-modifier → mutation-modifier
declaration-modifiers → declaration-modifier declaration-modifiers opt
标签:format default line rar dealloc isp operation declare automatic
原文地址:https://www.cnblogs.com/feng9exe/p/11228960.html