Deprecation and other attributes of methods in Swift, how?

Swift has an available attribute that you can use for this. It’s available arguments include

  • introduced
  • deprecated
  • obsoleted
  • message
  • renamed.

Or for the example you gave:

@available(*, unavailable, message: "init is unavailable, use initWithFrame")
init() {

}

@available(*, deprecated, message: "use shareWithPars: instead")
class func shareWithParams(params: NSDictionary) {

}

For more information on these attributes, check out the Attributes section in The Swift Programming Language. (currently page 627)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)