The approximate size of all literal segments combined. This is meant to be passed to String
; it may be slightly larger or smaller than the sum of the counts of each literal segment.
Initializerinit(literal
init(literalCapacity:interpolationCount:)
Creates an empty instance ready to be filled with string literal content.
Availability 有効性
- iOS 13.0+
- iPadOS 13.0+
- macOS 10.15+
- Mac Catalyst 13.0+
- tvOS 13.0+
- watchOS 6.0+
Technology
- Swift
UI
Declaration 宣言
Parameters パラメータ
literalCapacity
.reserve Capacity(_:) interpolationCount
The number of interpolations which will be appended. Use this value to estimate how much additional capacity will be needed for the interpolated segments.
Discussion 議論
Don’t call this initializer directly. Instead, initialize a variable or constant using a string literal with interpolated expressions.
Swift passes this initializer a pair of arguments specifying the size of the literal segments and the number of interpolated segments. Use this information to estimate the amount of storage you will need.