實例屬性
raw
rawValue
原始類型的對應值。
聲明
var rawValue: UInt
詳述
使用rawValue
初始化的新實例將等效於此實例。例如:
enum PaperSize: String {
case A4, A5, Letter, Legal
}
let selectedSize = PaperSize.Letter
print(selectedSize.rawValue)
// Prints "Letter"
print(selectedSize == PaperSize(rawValue: selectedSize.rawValue)!)
// Prints "true"
可用版本
iOS 8.0+, iPadOS 8.0+, macOS 10.10+, Mac Catalyst 13.0+, tvOS 9.0+, watchOS 2.0+
相關用法
- Swift String.Encoding init(rawValue:)用法及代碼示例
- Swift String.Encoding description用法及代碼示例
- Swift String.UTF8View first用法及代碼示例
- Swift String.UTF16View firstIndex(where:)用法及代碼示例
- Swift String.UTF16View last(where:)用法及代碼示例
- Swift String.UnicodeScalarView flatMap(_:)用法及代碼示例
- Swift String.UTF8View split(maxSplits:omittingEmptySubsequences:whereSeparator:)用法及代碼示例
- Swift String.UTF8View elementsEqual(_:)用法及代碼示例
- Swift String.UnicodeScalarView min(by:)用法及代碼示例
- Swift String.UnicodeScalarView lastIndex(of:)用法及代碼示例
- Swift String.UTF8View last(where:)用法及代碼示例
- Swift String.Index ..<(_:_:)用法及代碼示例
- Swift String.UTF8View split(separator:maxSplits:omittingEmptySubsequences:)用法及代碼示例
- Swift String.UnicodeScalarView filter(_:)用法及代碼示例
- Swift String.UTF8View debugDescription用法及代碼示例
- Swift String.UTF16View flatMap(_:)用法及代碼示例
- Swift String.UTF16View min(by:)用法及代碼示例
- Swift String.UTF16View shuffled(using:)用法及代碼示例
- Swift String.UTF8View isEmpty用法及代碼示例
- Swift String.UTF16View min()用法及代碼示例
- Swift String.UTF8View starts(with:)用法及代碼示例
- Swift String.UTF16View isEmpty用法及代碼示例
- Swift String.UTF16View indices用法及代碼示例
- Swift String.UTF8View randomElement(using:)用法及代碼示例
- Swift String.UTF16View map(_:)用法及代碼示例
注:本文由純淨天空篩選整理自apple.com大神的英文原創作品 String.Encoding rawValue。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。