init(_:strategy:)
Initialize an instance by parsing value
with the given strategy
.
- iOS
- 15.0+
- macOS
- 12.0+
- tvOS
- 15.0+
- watchOS
- 8.0+
init<S>(_ value: S.ParseInput, strategy: S) throws where S : ParseStrategy, S.ParseOutput == Decimal
Initialize an instance by parsing value
with the given strategy
.
init<S>(_ value: S.ParseInput, strategy: S) throws where S : ParseStrategy, S.ParseOutput == Decimal
s20FoundationEssentials7DecimalV0A20InternationalizationE_8strategyAC10ParseInputQz_xtKcAA0F8StrategyRzAC0F6OutputRtzlufc
What are these?6ZB4T
import FoundationEssentials
import FoundationInternationalization
struct Decimal
associatedtype ParseInput
The type of the representation describing the data.
protocol ParseStrategy : Decodable, Encodable, Hashable
A type that can parse a representation of a given data type.
associatedtype ParseOutput
The type of the data type.
init(_ value: String, format: Decimal.FormatStyle.Percent, lenient: Bool = true) throws
init(_ value: String, format: Decimal.FormatStyle.Currency, lenient: Bool = true) throws
init(_ value: String, format: Decimal.FormatStyle, lenient: Bool = true) throws
func formatted() -> String
Format self
using Decimal.FormatStyle
func formatted<S>(_ format: S) -> S.FormatOutput where S : FormatStyle, S.FormatInput == Decimal
Format self
with the given format.
struct FormatStyle
struct ParseStrategy<Format> where Format : FormatStyle, Format.FormatInput == Decimal