TypeName

abstract class TypeName

Any type in Swift's type system. This class identifies simple types like Int and String, composite types like Optional<String> and Set<String>, and unassignable types like Void.

Type names are dumb identifiers only and do not model the values they name. For example, the type name for Swift.Array doesn't know about the count property, the fact that arrays are collections, or even that it accepts a single type parameter.

Instances of this class are immutable value objects that implement equals() and hashCode() properly.

Defining new types

------------------

Create new reference types like MyModule.HelloWorld with DeclaredTypeName.typeName. To build composite types like Set<Long>, use the factory methods on ParameterizedTypeName and TypeVariableName.

Functions

equals
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
open override fun hashCode(): Int
makeNonOptional
Link copied to clipboard
open fun makeNonOptional(): TypeName
makeOptional
Link copied to clipboard
open fun makeOptional(): ParameterizedTypeName
toString
Link copied to clipboard
open override fun toString(): String
unwrapOptional
Link copied to clipboard
open fun unwrapOptional(): TypeName
wrapOptional
Link copied to clipboard
open fun wrapOptional(): ParameterizedTypeName

Properties

name
Link copied to clipboard
open val name: String
optional
Link copied to clipboard
open val optional: Boolean = false

Inheritors

ComposedTypeName
Link copied to clipboard
DeclaredTypeName
Link copied to clipboard
FunctionTypeName
Link copied to clipboard
ParameterizedTypeName
Link copied to clipboard
SelfTypeName
Link copied to clipboard
TupleTypeName
Link copied to clipboard
TypeVariableName
Link copied to clipboard