Subscript

@objcMembers
public final class Subscript : NSObject, SourceryModel, Annotated, Documented, Definition, Diffable
extension Subscript: NSCoding

Describes subscript

  • Method parameters

    Declaration

    Swift

    public var parameters: [MethodParameter]
  • Return value type name used in declaration, including generic constraints, i.e. where T: Equatable

    Declaration

    Swift

    public var returnTypeName: TypeName
  • Actual return value type name if declaration uses typealias, otherwise just a returnTypeName

    Declaration

    Swift

    public var actualReturnTypeName: TypeName { get }
  • Actual return value type, if known

    Declaration

    Swift

    public var returnType: Type?
  • Whether return value type is optional

    Declaration

    Swift

    public var isOptionalReturnType: Bool { get }
  • Whether return value type is implicitly unwrapped optional

    Declaration

    Swift

    public var isImplicitlyUnwrappedOptionalReturnType: Bool { get }
  • Return value type name without attributes and optional type information

    Declaration

    Swift

    public var unwrappedReturnTypeName: String { get }
  • Whether method is final

    Declaration

    Swift

    public var isFinal: Bool { get }
  • Variable read access level, i.e. internal, private, fileprivate, public, open

    Declaration

    Swift

    public let readAccess: String
  • Variable write access, i.e. internal, private, fileprivate, public, open. For immutable variables this value is empty string

    Declaration

    Swift

    public var writeAccess: String
  • Whether subscript is async

    Declaration

    Swift

    public let isAsync: Bool
  • Whether subscript throws

    Declaration

    Swift

    public let `throws`: Bool
  • Whether variable is mutable or not

    Declaration

    Swift

    public var isMutable: Bool { get }
  • Annotations, that were created with // sourcery: annotation1, other = “annotation value”, alterantive = 2

    Declaration

    Swift

    public let annotations: Annotations
  • Declaration

    Swift

    public let documentation: Documentation
  • Reference to type name where the method is defined, nil if defined outside of any enum, struct, class etc

    Declaration

    Swift

    public let definedInTypeName: TypeName?
  • Reference to actual type name where the method is defined if declaration uses typealias, otherwise just a definedInTypeName

    Declaration

    Swift

    public var actualDefinedInTypeName: TypeName? { get }
  • Reference to actual type where the object is defined, nil if defined outside of any enum, struct, class etc or type is unknown

    Declaration

    Swift

    public var definedInType: Type?
  • Method attributes, i.e. @discardableResult

    Declaration

    Swift

    public let attributes: AttributeList
  • Method modifiers, i.e. private

    Declaration

    Swift

    public let modifiers: [SourceryModifier]
  • list of generic parameters

    Declaration

    Swift

    public let genericParameters: [GenericParameter]
  • list of generic requirements

    Declaration

    Swift

    public let genericRequirements: [GenericRequirement]
  • Whether subscript is generic or not

    Declaration

    Swift

    public var isGeneric: Bool { get }
  • Declaration

    Swift

    public init(parameters: [MethodParameter] = [],
                returnTypeName: TypeName,
                accessLevel: (read: AccessLevel, write: AccessLevel) = (.internal, .internal),
                isAsync: Bool = false,
                `throws`: Bool = false,
                genericParameters: [GenericParameter] = [],
                genericRequirements: [GenericRequirement] = [],
                attributes: AttributeList = [:],
                modifiers: [SourceryModifier] = [],
                annotations: [String: NSObject] = [:],
                documentation: [String] = [],
                definedInTypeName: TypeName? = nil)
  • Declaration

    Swift

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