Sorry yeah you’re right, the example also requires conditional conformances. If
you do not need dynamic dispatch in your use case then you can workaround the
issue for now by hiding the protocol requirements and abusing the protocol
extension:
import UIKit
protocol AreaProtocol { /* keep it
Adrian,
thanks, but don’t work :-(
import Foundation
protocol AreaProtocol {
// required
funcarea() -> CGFloat
// implemented in protocol extension
funcvolume( height:CGFloat ) -> CGFloat
//
}
extension AreaProtocol {
func
This is correct. None of your types does conform to your protocol because you
never conformance explicitly.
The extenstion you wrote is just a conditional extension which says if the Self
type conforms to AreaProtocol and the associated typed Element is a CGPoint
then add the area method to