Type

@objcMembers
public class Type : NSObject, SourceryModel, Annotated, Documented, Diffable
extension Type: NSCoding

Defines Swift type

  • Imports that existed in the file that contained this type declaration

    Declaration

    Swift

    public var imports: [Import]
  • Imports existed in all files containing this type and all its super classes/protocols

    Declaration

    Swift

    public var allImports: [Import] { get }
  • Whether declaration is an extension of some type

    Declaration

    Swift

    public var isExtension: Bool
  • Kind of type declaration, i.e. enum, struct, class, protocol or extension

    Declaration

    Swift

    public var kind: String { get }
  • Type access level, i.e. internal, private, fileprivate, public, open

    Declaration

    Swift

    public let accessLevel: String
  • Type name in global scope. For inner types includes the name of its containing type, i.e. Type.Inner

    Declaration

    Swift

    public var name: String { get }
  • Whether the type has been resolved as unknown extension

    Declaration

    Swift

    public var isUnknownExtension: Bool
  • Global type name including module name, unless it’s an extension of unknown type

    Declaration

    Swift

    public var globalName: String { get }
  • Whether type is generic

    Declaration

    Swift

    public var isGeneric: Bool
  • Type name in its own scope.

    Declaration

    Swift

    public var localName: String
  • Variables defined in this type only, inluding variables defined in its extensions, but not including variables inherited from superclasses (for classes only) and protocols

    Declaration

    Swift

    public var variables: [Variable] { get }
  • Unfiltered (can contain duplications from extensions) variables defined in this type only, inluding variables defined in its extensions, but not including variables inherited from superclasses (for classes only) and protocols

    Declaration

    Swift

    public var rawVariables: [Variable]
  • All variables defined for this type, including variables defined in extensions, in superclasses (for classes only) and protocols

    Declaration

    Swift

    public var allVariables: [Variable] { get }
  • Methods defined in this type only, inluding methods defined in its extensions, but not including methods inherited from superclasses (for classes only) and protocols

    Declaration

    Swift

    public var methods: [Method] { get }
  • Unfiltered (can contain duplications from extensions) methods defined in this type only, inluding methods defined in its extensions, but not including methods inherited from superclasses (for classes only) and protocols

    Declaration

    Swift

    public var rawMethods: [Method]
  • All methods defined for this type, including methods defined in extensions, in superclasses (for classes only) and protocols

    Declaration

    Swift

    public var allMethods: [Method] { get }
  • Subscripts defined in this type only, inluding subscripts defined in its extensions, but not including subscripts inherited from superclasses (for classes only) and protocols

    Declaration

    Swift

    public var subscripts: [Subscript] { get }
  • Unfiltered (can contain duplications from extensions) Subscripts defined in this type only, inluding subscripts defined in its extensions, but not including subscripts inherited from superclasses (for classes only) and protocols

    Declaration

    Swift

    public var rawSubscripts: [Subscript]
  • All subscripts defined for this type, including subscripts defined in extensions, in superclasses (for classes only) and protocols

    Declaration

    Swift

    public var allSubscripts: [Subscript] { get }
  • Bytes position of the body of this type in its declaration file if available.

    Declaration

    Swift

    public var bodyBytesRange: BytesRange?
  • Bytes position of the whole declaration of this type in its declaration file if available.

    Declaration

    Swift

    public var completeDeclarationRange: BytesRange?
  • All initializers defined in this type

    Declaration

    Swift

    public var initializers: [Method] { get }
  • All annotations for this type

    Declaration

    Swift

    public var annotations: Annotations
  • Declaration

    Swift

    public var documentation: Documentation
  • Static variables defined in this type

    Declaration

    Swift

    public var staticVariables: [Variable] { get }
  • Static methods defined in this type

    Declaration

    Swift

    public var staticMethods: [Method] { get }
  • Class methods defined in this type

    Declaration

    Swift

    public var classMethods: [Method] { get }
  • Instance variables defined in this type

    Declaration

    Swift

    public var instanceVariables: [Variable] { get }
  • Instance methods defined in this type

    Declaration

    Swift

    public var instanceMethods: [Method] { get }
  • Computed instance variables defined in this type

    Declaration

    Swift

    public var computedVariables: [Variable] { get }
  • Stored instance variables defined in this type

    Declaration

    Swift

    public var storedVariables: [Variable] { get }
  • Names of types this type inherits from (for classes only) and protocols it implements, in order of definition

    Declaration

    Swift

    public var inheritedTypes: [String] { get set }
  • Names of types or protocols this type inherits from, including unknown (not scanned) types

    Declaration

    Swift

    public var based: [String : String]
  • Types this type inherits from or implements, including unknown (not scanned) types with extensions defined

    Declaration

    Swift

    public var basedTypes: [String : Type]
  • Types this type inherits from

    Declaration

    Swift

    public var inherits: [String : Type]
  • Protocols this type implements. Does not contain classes in case where composition (&) is used in the declaration

    Declaration

    Swift

    public var implements: [String : Type]
  • Contained types

    Declaration

    Swift

    public var containedTypes: [Type] { get set }
  • Contained types groupd by their names

    Declaration

    Swift

    public private(set) var containedType: [String : Type] { get }
  • Name of parent type (for contained types only)

    Declaration

    Swift

    public private(set) var parentName: String? { get }
  • Parent type, if known (for contained types only)

    Declaration

    Swift

    public var parent: Type? { get set }
  • Superclass type, if known (only for classes)

    Declaration

    Swift

    public var supertype: Type?
  • Type attributes, i.e. @objc

    Declaration

    Swift

    public var attributes: AttributeList
  • Type modifiers, i.e. private, final

    Declaration

    Swift

    public var modifiers: [SourceryModifier]
  • Path to file where the type is defined

    Declaration

    Swift

    public var path: String? { get set }
  • Directory to file where the type is defined

    Declaration

    Swift

    public var directory: String? { get }
  • list of generic requirements

    Declaration

    Swift

    public var genericRequirements: [GenericRequirement] { get set }
  • File name where the type was defined

    Declaration

    Swift

    public var fileName: String?
  • Declaration

    Swift

    public func diffAgainst(_ object: Any?) -> DiffableResult