基本Swift类型的完整列表

时间:2014-09-09 22:56:28

标签: swift

来自Swift文档:

  

Swift提供了所有基本C和Objective-C的版本   类型,包括整数的 Int ,浮点的 Double Float   值,布尔表示布尔值,字符串表示文本数据。迅速   还提供两种主要集合类型的强大版本,   数组字典,如“收集类型”中所述。

它是基本类型的综合列表还是除了上面提到的这7个之外还有其他基本类型?

有人可以提供完整的类型清单吗?

3 个答案:

答案 0 :(得分:5)

更新

从Xcode 9.4(包括Swift 4.1.2)开始,您可以通过输入import Swift,选择单词Swift,然后跳转到其中,让Xcode向您显示其标准库的声明。定义

Xcode 9.4 demo

我复制了该生成文件的内容并运行了此命令:

pbpaste | egrep '^public (struct|protocol|class|enum)' > /tmp/swifttypes

结果如下:

public struct AnyBidirectionalCollection<Element> {
public struct AnyCollection<Element> {
public struct AnyHashable {
public struct AnyIndex {
public struct AnyIterator<Element> {
public class AnyKeyPath : Hashable, _AppendKeyPath {
public struct AnyRandomAccessCollection<Element> {
public struct AnySequence<Element> {
public struct Array<Element> {
public struct ArraySlice<Element> {
public struct AutoreleasingUnsafeMutablePointer<Pointee> {
public protocol BidirectionalCollection : Collection where Self.Indices : BidirectionalCollection, Self.SubSequence : BidirectionalCollection {
public protocol BinaryFloatingPoint : ExpressibleByFloatLiteral, FloatingPoint {
public protocol BinaryInteger : CustomStringConvertible, Hashable, Numeric, Strideable where Self.Magnitude : BinaryInteger, Self.Magnitude == Self.Magnitude.Magnitude {
public struct Bool {
public struct CVaListPointer {
public protocol CVarArg {
public struct Character {
public struct ClosedRange<Bound> where Bound : Comparable {
public struct ClosedRangeIndex<Bound> where Bound : Strideable, Bound.Stride : SignedInteger {
public protocol CodingKey : CustomDebugStringConvertible, CustomStringConvertible {
public struct CodingUserInfoKey : RawRepresentable, Equatable, Hashable {
public protocol Collection : Sequence where Self.SubSequence : Collection {
public struct CollectionOfOne<Element> {
public enum CommandLine {
public protocol Comparable : Equatable {
public struct ContiguousArray<Element> {
public struct CountableClosedRange<Bound> where Bound : Strideable, Bound.Stride : SignedInteger {
public struct CountablePartialRangeFrom<Bound> where Bound : Strideable, Bound.Stride : SignedInteger {
public struct CountableRange<Bound> where Bound : Strideable, Bound.Stride : SignedInteger {
public protocol CustomDebugStringConvertible {
public protocol CustomLeafReflectable : CustomReflectable {
public protocol CustomPlaygroundDisplayConvertible {
public protocol CustomPlaygroundQuickLookable {
public protocol CustomReflectable {
public protocol CustomStringConvertible {
public protocol Decodable {
public protocol Decoder {
public enum DecodingError : Error {
public struct DefaultIndices<Elements> where Elements : Collection {
public struct Dictionary<Key, Value> where Key : Hashable {
public struct DictionaryIterator<Key, Value> : IteratorProtocol where Key : Hashable {
public struct DictionaryLiteral<Key, Value> : ExpressibleByDictionaryLiteral {
public struct Double {
public struct EmptyCollection<Element> {
public struct EmptyIterator<Element> {
public protocol Encodable {
public protocol Encoder {
public enum EncodingError : Error {
public struct EnumeratedIterator<Base> where Base : IteratorProtocol {
public struct EnumeratedSequence<Base> where Base : Sequence {
public protocol Equatable {
public protocol Error {
public protocol ExpressibleByArrayLiteral {
public protocol ExpressibleByBooleanLiteral {
public protocol ExpressibleByDictionaryLiteral {
public protocol ExpressibleByExtendedGraphemeClusterLiteral : ExpressibleByUnicodeScalarLiteral {
public protocol ExpressibleByFloatLiteral {
public protocol ExpressibleByIntegerLiteral {
public protocol ExpressibleByNilLiteral {
public protocol ExpressibleByStringLiteral : ExpressibleByExtendedGraphemeClusterLiteral {
public protocol ExpressibleByUnicodeScalarLiteral {
public protocol FixedWidthInteger : BinaryInteger, LosslessStringConvertible, _BitwiseOperations where Self.Magnitude : FixedWidthInteger {
public struct FlattenBidirectionalCollection<Base> : BidirectionalCollection where Base : BidirectionalCollection, Base.Element : BidirectionalCollection {
public struct FlattenBidirectionalCollectionIndex<BaseElements> where BaseElements : BidirectionalCollection, BaseElements.Element : BidirectionalCollection {
public struct FlattenCollection<Base> : Collection where Base : Collection, Base.Element : Collection {
public struct FlattenCollectionIndex<BaseElements> where BaseElements : Collection, BaseElements.Element : Collection {
public struct FlattenIterator<Base> : IteratorProtocol, Sequence where Base : IteratorProtocol, Base.Element : Sequence {
public struct FlattenSequence<Base> : Sequence where Base : Sequence, Base.Element : Sequence {
public struct Float {
public struct Float80 {
public protocol FloatingPoint : Hashable, SignedNumeric, Strideable {
public enum FloatingPointClassification {
public enum FloatingPointRoundingRule {
public enum FloatingPointSign : Int {
public protocol Hashable : Equatable {
public enum ImplicitlyUnwrappedOptional<Wrapped> : ExpressibleByNilLiteral {
public struct IndexingIterator<Elements> where Elements : Collection {
public struct Int : FixedWidthInteger, SignedInteger {
public struct Int16 : FixedWidthInteger, SignedInteger {
public struct Int32 : FixedWidthInteger, SignedInteger {
public struct Int64 : FixedWidthInteger, SignedInteger {
public struct Int8 : FixedWidthInteger, SignedInteger {
public struct IteratorOverOne<Element> {
public protocol IteratorProtocol {
public struct IteratorSequence<Base> where Base : IteratorProtocol {
public struct JoinedIterator<Base> : IteratorProtocol where Base : IteratorProtocol, Base.Element : Sequence {
public struct JoinedSequence<Base> : Sequence where Base : Sequence, Base.Element : Sequence {
public class KeyPath<Root, Value> : PartialKeyPath<Root> {
public struct KeyedDecodingContainer<K> : KeyedDecodingContainerProtocol where K : CodingKey {
public protocol KeyedDecodingContainerProtocol {
public struct KeyedEncodingContainer<K> : KeyedEncodingContainerProtocol where K : CodingKey {
public protocol KeyedEncodingContainerProtocol {
public struct LazyCollection<Base> : LazyCollectionProtocol where Base : Collection {
public protocol LazyCollectionProtocol : Collection, LazySequenceProtocol where Self.Elements : Collection {
public struct LazyDropWhileBidirectionalCollection<Base> : LazyCollectionProtocol, BidirectionalCollection where Base : BidirectionalCollection {
public struct LazyDropWhileCollection<Base> : LazyCollectionProtocol, Collection where Base : Collection {
public struct LazyDropWhileIndex<Base> : Comparable where Base : Collection {
public struct LazyDropWhileIterator<Base> : IteratorProtocol, Sequence where Base : IteratorProtocol {
public struct LazyDropWhileSequence<Base> : LazySequenceProtocol where Base : Sequence {
public struct LazyFilterCollection<Base> where Base : Collection {
public struct LazyFilterIterator<Base> : IteratorProtocol, Sequence where Base : IteratorProtocol {
public struct LazyFilterSequence<Base> : LazySequenceProtocol where Base : Sequence {
public struct LazyMapCollection<Base, Element> : LazyCollectionProtocol, Collection where Base : Collection {
public struct LazyMapIterator<Base, Element> : IteratorProtocol, Sequence where Base : IteratorProtocol {
public struct LazyMapSequence<Base, Element> : LazySequenceProtocol where Base : Sequence {
public struct LazyPrefixWhileBidirectionalCollection<Base> : LazyCollectionProtocol, BidirectionalCollection where Base : BidirectionalCollection {
public struct LazyPrefixWhileCollection<Base> : LazyCollectionProtocol, Collection where Base : Collection {
public struct LazyPrefixWhileIndex<Base> : Comparable where Base : Collection {
public struct LazyPrefixWhileIterator<Base> : IteratorProtocol, Sequence where Base : IteratorProtocol {
public struct LazyPrefixWhileSequence<Base> : LazySequenceProtocol where Base : Sequence {
public struct LazySequence<Base> : LazySequenceProtocol, _SequenceWrapper where Base : Sequence {
public protocol LazySequenceProtocol : Sequence {
public protocol LosslessStringConvertible : CustomStringConvertible {
public struct ManagedBufferPointer<Header, Element> : Equatable {
public enum MemoryLayout<T> {
public struct Mirror {
public protocol MirrorPath {
public protocol MutableCollection : Collection where Self.SubSequence : MutableCollection {
public enum Never {
public protocol Numeric : Equatable, ExpressibleByIntegerLiteral {
public struct ObjectIdentifier {
public struct OpaquePointer {
public protocol OptionSet : RawRepresentable, SetAlgebra {
public enum Optional<Wrapped> : ExpressibleByNilLiteral {
public class PartialKeyPath<Root> : AnyKeyPath {
public struct PartialRangeFrom<Bound> where Bound : Comparable {
public struct PartialRangeThrough<Bound> where Bound : Comparable {
public struct PartialRangeUpTo<Bound> where Bound : Comparable {
public enum PlaygroundQuickLook {
public protocol RandomAccessCollection : BidirectionalCollection where Self.Indices : RandomAccessCollection, Self.SubSequence : RandomAccessCollection {
public struct Range<Bound> where Bound : Comparable {
public protocol RangeExpression {
public protocol RangeReplaceableCollection : Collection where Self.SubSequence : RangeReplaceableCollection {
public protocol RawRepresentable {
public class ReferenceWritableKeyPath<Root, Value> : WritableKeyPath<Root, Value> {
public struct Repeated<Element> {
public struct ReversedCollection<Base> where Base : BidirectionalCollection {
public struct ReversedIndex<Base> : Comparable where Base : Collection {
public protocol Sequence {
public struct Set<Element> where Element : Hashable {
public protocol SetAlgebra : Equatable, ExpressibleByArrayLiteral {
public struct SetIterator<Element> : IteratorProtocol where Element : Hashable {
public protocol SignedInteger : BinaryInteger, SignedNumeric {
public protocol SignedNumeric : Numeric {
public protocol SingleValueDecodingContainer {
public protocol SingleValueEncodingContainer {
public struct Slice<Base> where Base : Collection {
public struct StaticString : ExpressibleByUnicodeScalarLiteral, ExpressibleByExtendedGraphemeClusterLiteral, ExpressibleByStringLiteral, CustomStringConvertible, CustomDebugStringConvertible, CustomReflectable {
public struct StrideThrough<Element> where Element : Strideable {
public struct StrideThroughIterator<Element> where Element : Strideable {
public struct StrideTo<Element> where Element : Strideable {
public struct StrideToIterator<Element> where Element : Strideable {
public protocol Strideable : Comparable {
public struct String {
public protocol StringProtocol : BidirectionalCollection, Comparable, ExpressibleByStringLiteral, Hashable, LosslessStringConvertible, TextOutputStream, TextOutputStreamable where Self.Element == Character, Self.SubSequence : StringProtocol {
public struct Substring : StringProtocol {
public protocol TextOutputStream {
public protocol TextOutputStreamable {
public struct UInt : FixedWidthInteger, UnsignedInteger {
public struct UInt16 : FixedWidthInteger, UnsignedInteger {
public struct UInt32 : FixedWidthInteger, UnsignedInteger {
public struct UInt64 : FixedWidthInteger, UnsignedInteger {
public struct UInt8 : FixedWidthInteger, UnsignedInteger {
public enum UnboundedRange_ {
public struct UnfoldSequence<Element, State> : Sequence, IteratorProtocol {
public enum Unicode {
public protocol UnicodeCodec : _UnicodeEncoding {
public enum UnicodeDecodingResult : Equatable {
public protocol UnkeyedDecodingContainer {
public protocol UnkeyedEncodingContainer {
public struct Unmanaged<Instance> where Instance : AnyObject {
public struct UnsafeBufferPointer<Element> : Collection, RandomAccessCollection {
public struct UnsafeBufferPointerIterator<Element> : IteratorProtocol, Sequence {
public struct UnsafeMutableBufferPointer<Element> : MutableCollection, RandomAccessCollection {
public struct UnsafeMutablePointer<Pointee> {
public struct UnsafeMutableRawBufferPointer {
public struct UnsafeMutableRawPointer {
public struct UnsafePointer<Pointee> {
public struct UnsafeRawBufferPointer {
public struct UnsafeRawPointer {
public protocol UnsignedInteger : BinaryInteger {
public class WritableKeyPath<Root, Value> : KeyPath<Root, Value> {
public struct Zip2Iterator<Iterator1, Iterator2> where Iterator1 : IteratorProtocol, Iterator2 : IteratorProtocol {
public struct Zip2Sequence<Sequence1, Sequence2> where Sequence1 : Sequence, Sequence2 : Sequence {
public protocol _AppendKeyPath {
public protocol _SequenceWrapper : Sequence {

原始

这是Swift文档目前令人遗憾的领域之一。

无论如何,您可以通过创建Swift源文件或游乐场找到完整的Swift内置API,输入任何内置类型(或函数),然后按住Command键单击它:

getting to swift API

这会将您带到生成的Swift源文件(它不存在于Xcode包中),该文件声明了整个内置的Swift API。您可以浏览它以查找所有内置类型。您提到的每种类型(偶数ArrayDictionary)都声明为struct,通常带有一堆extension个。还有更多内置struct类型,以及一堆protocolclass类型。

通过egrep '^(struct|protocol|class)管道该文件会找到这些内置类型:

protocol AbsoluteValuable : SignedNumberType {
protocol AnyObject {
struct Array<T> : MutableCollectionType, Sliceable {
protocol ArrayBoundType {
protocol ArrayLiteralConvertible {
struct AssertString : AssertStringType, StringInterpolationConvertible {
protocol AssertStringType : ExtendedGraphemeClusterLiteralConvertible, StringLiteralConvertible {
struct AutoreleasingUnsafeMutablePointer<T> : Equatable, NilLiteralConvertible {
protocol BidirectionalIndexType : ForwardIndexType, _BidirectionalIndexType {
struct BidirectionalReverseView<T : CollectionType where T.Index : BidirectionalIndexType> : CollectionType {
protocol BitwiseOperationsType {
struct Bool {
protocol BooleanLiteralConvertible {
protocol BooleanType {
struct CFunctionPointer<T> : Equatable, Hashable, NilLiteralConvertible {
struct COpaquePointer : Equatable, Hashable, NilLiteralConvertible {
struct CVaListPointer {
protocol CVarArgType {
protocol CharacterLiteralConvertible {
struct ClosedInterval<T : Comparable> : IntervalType, Equatable, Printable, DebugPrintable, Reflectable {
struct CollectionOfOne<T> : CollectionType {
protocol CollectionType : _CollectionType, SequenceType {
protocol Comparable : _Comparable, Equatable {
struct ContiguousArray<T> : MutableCollectionType, Sliceable {
protocol DebugPrintable {
struct Dictionary<Key : Hashable, Value> : CollectionType, DictionaryLiteralConvertible {
struct DictionaryGenerator<Key : Hashable, Value> : GeneratorType {
struct DictionaryIndex<Key : Hashable, Value> : BidirectionalIndexType, Comparable {
protocol DictionaryLiteralConvertible {
struct Double {
struct EmptyCollection<T> : CollectionType {
struct EmptyGenerator<T> : GeneratorType, SequenceType {
struct EnumerateGenerator<Base : GeneratorType> : GeneratorType, SequenceType {
protocol Equatable {
protocol ExtendedGraphemeClusterLiteralConvertible {
protocol ExtensibleCollectionType : _ExtensibleCollectionType {
struct FilterCollectionView<Base : CollectionType> : CollectionType {
struct FilterCollectionViewIndex<Base : CollectionType> : ForwardIndexType {
struct FilterGenerator<Base : GeneratorType> : GeneratorType, SequenceType {
struct FilterSequenceView<Base : SequenceType> : SequenceType {
struct Float {
struct Float80 {
protocol FloatLiteralConvertible {
protocol FloatingPointType : Strideable {
protocol ForwardIndexType : _ForwardIndexType {
struct GeneratorOf<T> : GeneratorType, SequenceType {
struct GeneratorOfOne<T> : GeneratorType, SequenceType {
struct GeneratorSequence<G : GeneratorType> : GeneratorType, SequenceType {
protocol GeneratorType {
struct HalfOpenInterval<T : Comparable> : IntervalType, Equatable, Printable, DebugPrintable, Reflectable {
protocol Hashable : Equatable {
struct HeapBuffer<Value, Element> : Equatable {
class HeapBufferStorage<Value, Element> : HeapBufferStorageBase {
class HeapBufferStorageBase {
struct IndexingGenerator<C : _CollectionType> : GeneratorType, SequenceType {
struct Int : SignedIntegerType {
struct Int16 : SignedIntegerType {
struct Int32 : SignedIntegerType {
struct Int64 : SignedIntegerType {
struct Int8 : SignedIntegerType {
protocol IntegerArithmeticType : _IntegerArithmeticType, Comparable {
protocol IntegerLiteralConvertible {
protocol IntegerType : _IntegerType, RandomAccessIndexType {
protocol IntervalType {
struct LazyBidirectionalCollection<S : CollectionType where S.Index : BidirectionalIndexType> : CollectionType {
struct LazyForwardCollection<S : CollectionType where S.Index : ForwardIndexType> : CollectionType {
struct LazyRandomAccessCollection<S : CollectionType where S.Index : RandomAccessIndexType> : CollectionType {
struct LazySequence<S : SequenceType> : SequenceType {
struct MapCollectionView<Base : CollectionType, T> : CollectionType {
struct MapSequenceGenerator<Base : GeneratorType, T> : GeneratorType, SequenceType {
struct MapSequenceView<Base : SequenceType, T> : SequenceType {
protocol MirrorType {
protocol MutableCollectionType : CollectionType {
protocol MutableSliceable : Sliceable, MutableCollectionType {
protocol NilLiteralConvertible {
struct ObjectIdentifier : Hashable {
struct OnHeap<T> {
protocol OutputStreamType {
struct PermutationGenerator<C : CollectionType, Indices : SequenceType where C.Index == C.Index> : GeneratorType, SequenceType {
protocol Printable {
protocol RandomAccessIndexType : BidirectionalIndexType, _RandomAccessIndexType {
struct RandomAccessReverseView<T : CollectionType where T.Index : RandomAccessIndexType> : CollectionType {
struct Range<T : ForwardIndexType> : Equatable, CollectionType, Printable, DebugPrintable {
struct RangeGenerator<T : ForwardIndexType> : GeneratorType, SequenceType {
protocol RangeReplaceableCollectionType : ExtensibleCollectionType {
struct RawByte {
protocol RawOptionSetType : _RawOptionSetType, BitwiseOperationsType, NilLiteralConvertible {
protocol RawRepresentable {
protocol Reflectable {
struct Repeat<T> : CollectionType {
struct ReverseBidirectionalIndex<I : BidirectionalIndexType> : BidirectionalIndexType {
struct ReverseRandomAccessIndex<I : RandomAccessIndexType> : RandomAccessIndexType {
struct SequenceOf<T> : SequenceType {
protocol SequenceType : _Sequence_Type {
protocol SignedIntegerType : _SignedIntegerType, IntegerType {
protocol SignedNumberType : _SignedNumberType {
struct SinkOf<T> : SinkType {
protocol SinkType {
struct Slice<T> : MutableCollectionType, Sliceable {
protocol Sliceable : _Sliceable {
struct StaticString : StaticStringType {
protocol StaticStringType : AssertStringType {
protocol Streamable {
struct StrideThrough<T : Strideable> : SequenceType {
struct StrideThroughGenerator<T : Strideable> : GeneratorType {
struct StrideTo<T : Strideable> : SequenceType {
struct StrideToGenerator<T : Strideable> : GeneratorType {
protocol Strideable : Comparable, _Strideable {
struct String {
protocol StringElementType {
protocol StringInterpolationConvertible {
protocol StringLiteralConvertible : ExtendedGraphemeClusterLiteralConvertible {
struct UInt : UnsignedIntegerType {
struct UInt16 : UnsignedIntegerType {
struct UInt32 : UnsignedIntegerType {
struct UInt64 : UnsignedIntegerType {
struct UInt8 : UnsignedIntegerType {
struct UTF16 : UnicodeCodecType {
struct UTF32 : UnicodeCodecType {
struct UTF8 : UnicodeCodecType {
protocol UnicodeCodecType {
struct UnicodeScalar : ExtendedGraphemeClusterLiteralConvertible {
struct Unmanaged<T> {
struct UnsafeBufferPointer<T> : CollectionType {
struct UnsafeBufferPointerGenerator<T> : GeneratorType, SequenceType {
struct UnsafeMutableBufferPointer<T> : MutableCollectionType {
struct UnsafeMutablePointer<T> : RandomAccessIndexType, Hashable, NilLiteralConvertible {
struct UnsafePointer<T> : RandomAccessIndexType, Hashable, NilLiteralConvertible {
protocol UnsignedIntegerType : _UnsignedIntegerType, IntegerType {
struct Zip2<S0 : SequenceType, S1 : SequenceType> : SequenceType {
struct ZipGenerator2<E0 : GeneratorType, E1 : GeneratorType> : GeneratorType {
protocol _ArrayBufferType : MutableCollectionType {
protocol _BidirectionalIndexType : _ForwardIndexType {
protocol _CocoaStringType {
protocol _CollectionType : _SequenceType {
protocol _Comparable {
protocol _ExtensibleCollectionType : CollectionType {
protocol _ForwardIndexType : _Incrementable {
protocol _Incrementable : Equatable {
protocol _IntegerArithmeticType {
protocol _IntegerType : IntegerLiteralConvertible, Printable, ArrayBoundType, Hashable, IntegerArithmeticType, BitwiseOperationsType, _Incrementable {
protocol _ObjectiveCBridgeable {
protocol _PrintableNSObjectType {
protocol _RandomAccessIndexType : _BidirectionalIndexType, Strideable {
protocol _RawOptionSetType : RawRepresentable, Equatable {
protocol _SequenceType {
protocol _Sequence_Type : _SequenceType {
protocol _SignedIntegerType : _IntegerType, SignedNumberType {
protocol _SignedNumberType : Comparable, IntegerLiteralConvertible {
protocol _Sliceable : CollectionType {
protocol _Strideable {
protocol _SwiftNSArrayRequiredOverridesType : _SwiftNSCopyingType, _SwiftNSFastEnumerationType {
protocol _SwiftNSCopyingType {
protocol _SwiftNSDictionaryRequiredOverridesType : _SwiftNSCopyingType, _SwiftNSFastEnumerationType {
protocol _SwiftNSEnumeratorType {
protocol _SwiftNSFastEnumerationType {
protocol _SwiftNSStringRequiredOverridesType : _SwiftNSCopyingType, _SwiftNSFastEnumerationType {
protocol _SwiftNSStringType : _SwiftNSStringRequiredOverridesType {
protocol _UnsignedIntegerType : _IntegerType {

答案 1 :(得分:4)

Swift的基本数据类型

String,Bool,Int,Int8,Int16,Int32,Int64,UInt,UInt8,UInt16,UInt32,UInt64,Float,Float80,Double

答案 2 :(得分:2)

罗布斯的回答(像往常一样)很棒,但是有一些比较值得提出的细微差别(而不是评论) - 你说的是一个设计领域Swift与基于C语言的不同。

在C(以及通过扩展名ObjC)中,有&#34;基础&#34; (或&#34;原语&#34;)类型由语言(intfloatunsigned long等)指定和/或由编译器实现(__darwin_size_t等)。还有更高级别的类型,您(或图书馆作者)根据基本类型合成:要么将新类型定义为基本类型的别名(使用typedef#define),要么基本类型的化合物(使用struct s,指针/数组或ObjC类)。

在Swift中,没有基本类型。 1 而不是某些类型是特殊的,因为它们是其他类型的基础,标准库类型是相同类型的构造作为您可以自己定义的类型。 (换句话说,所有Swift类型都是基础。)你甚至可以定义自己的类型,就像&#34;基本的&#34;使用LiteralConvertible协议的类型。

我认为文档中的段落是有一个Swift类型相当于所有基本的C类型,而不是Swift有自己的一组&#34;基础&#34;类型。


1 好的,Swift确实有一些特殊的编译器实现类型:例如,您将在Int的标准库定义中看到它基于它在编译器的Builtin.Word类型上。但与C中不同的是,#34;内置&#34;类型是您使用的语言的一部分,在Swift中它们只是一个底层的实现细节。