我记得 Swift 中有一个 Byte 数据类型,但我已经有大约六个月没有进行任何 Swift 编程了。
现在当我在 iOS playground 中写作时:
//: Playground - noun: a place where people can play
var str = [Byte]
我得到一个错误:Use of unresolved identifier 'Byte'
我一直在谷歌上搜索,找不到任何关于 Byte 数据类型的文档,但我很确定我以前用过它。
这是怎么回事?
最佳答案
现在,您不能使用这种类型的数据,实际上它是 8 位 UInt8
类型的别名,现在您必须使用 UInt8
来自 MacTypes.h
:
... /********************************************************************************* Old names for types *********************************************************************************/ typedef UInt8 Byte; ...
UInt8
类型的旧名称
关于swift - Swift 2.1 中的字节数据类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33895465/