【发布时间】:2018-10-28 20:53:30
【问题描述】:
如何将 NSDateComponent 对象或引用作为函数参数(只读)传递?以下代码在“编译”时失败,并出现“使用未声明的类型 'NSDateComponent'”错误:
import Foundation
class PreventativeCare {
var birthday = NSDateComponents()
func setPatientDOB(birthdate:NSDateComponent /* compile error */ ) {
birthday.day = birthdate.day
birthday.month = birthdate.month
birthday.year = birthdate.year
}
}
【问题讨论】:
标签: swift function parameter-passing