swift - Swift 2.1 中的字节数据类型

标签 swift swift2

我记得 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/

相关文章:

ios - swift 拥有保证

ios - 创建自定义模糊 UIView

ios - 在后台检测 MPMusicPlayerController 通知

ios - 从 JSON 图像 url swift 填充 collectionView

ios - 如何检测在swift 2中单击了哪个表格单元格

ios - 带有单例字符串的 UILabel.text 为 nil - 警告 : Attempt to present ** whose view is not in the window hierarchy

swift - 当滚动单元格时更改焦点和颜色

swift - 快速观察者

ios - swift 协议(protocol) : Custom Property Setter Crash because of Recursive loop

swift2 - Swift 中嵌套类型的扩展