TypeName

@objcMembers
public final class TypeName : NSObject, SourceryModelWithoutDescription, LosslessStringConvertible

Describes name of the type used in typed declaration (variable, method parameter or return value etc.)

  • Type name used in declaration

    Declaration

    Swift

    public var name: String
  • The generics of this TypeName

    Declaration

    Swift

    public var generic: GenericType?
  • Whether this TypeName is generic

    Declaration

    Swift

    public var isGeneric: Bool { get }
  • Whether this TypeName is protocol composition

    Declaration

    Swift

    public var isProtocolComposition: Bool
  • Actual type name if given type name is a typealias

    Declaration

    Swift

    public var actualTypeName: TypeName?
  • Type name attributes, i.e. @escaping

    Declaration

    Swift

    public var attributes: AttributeList
  • Modifiers, i.e. escaping

    Declaration

    Swift

    public var modifiers: [SourceryModifier]
  • Whether type is optional

    Declaration

    Swift

    public let isOptional: Bool
  • Whether type is implicitly unwrapped optional

    Declaration

    Swift

    public let isImplicitlyUnwrappedOptional: Bool
  • Type name without attributes and optional type information

    Declaration

    Swift

    public var unwrappedTypeName: String
  • Whether type is void (Void or ())

    Declaration

    Swift

    public var isVoid: Bool { get }
  • Whether type is a tuple

    Declaration

    Swift

    public var isTuple: Bool { get }
  • Tuple type data

    Declaration

    Swift

    public var tuple: TupleType?
  • Whether type is an array

    Declaration

    Swift

    public var isArray: Bool { get }
  • Array type data

    Declaration

    Swift

    public var array: ArrayType?
  • Whether type is a dictionary

    Declaration

    Swift

    public var isDictionary: Bool { get }
  • Dictionary type data

    Declaration

    Swift

    public var dictionary: DictionaryType?
  • Whether type is a closure

    Declaration

    Swift

    public var isClosure: Bool { get }
  • Closure type data

    Declaration

    Swift

    public var closure: ClosureType?
  • Prints typename as it would appear on definition

    Declaration

    Swift

    public var asSource: String { get }
  • Declaration

    Swift

    public convenience init(_ description: String)