在 Swift 中区分结构和类 [英] Differentiating Between a Struct and a Class in Swift

查看:46
本文介绍了在 Swift 中区分结构和类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道为什么我会使用结构而不是类,但是我如何才能最好地判断我正在使用的 API 正在使用哪个?

I know why I would use a struct as opposed to a class, but how could I best tell which is being used by an API I'm using?

显然查看头文件(或希望文档)应该立即显而易见.我想知道是否有办法知道我使用的对象是面值的结构体还是类?

Obviously looking at the header file (or hopefully documentation) should make it immediately obvious. I am wondering if there is a way to know if the object I am using is a struct or class on face value though?

推荐答案

Xcode中的自动补全知道类型的类型:

Auto completion in Xcode knows the type of type:

这篇关于在 Swift 中区分结构和类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆