Faisal Syed Faisal Syed - 1 year ago 196
Objective-C Question

Method intrinsicContentSize() conflicts with getter from superclass

The following function in Swift 3 gives off a compiler error:

func intrinsicContentSize() -> CGSize {
return CGSize(width: 0.0, height: 55.0)

"Method 'intrinsicContentSize()' with Objective-C selector 'intrinsicContentSize' conflicts with getter for 'intrinsicContentSize' from superclass 'UIView' with the same Objective-C Selector"

How do I apply this function in Swift 3?

Answer Source

This is a property, not a method, so in Swift it's overridden using the property syntax rather than a getter method as it would be in Objective-C:

override var intrinsicContentSize: CGSize {
    return CGSize(width: 0.0, height: 55.0)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download