[swift-users] Attempting to call default protocol implementation crashes Playground

Rick Mann rmann at latencyzero.com
Tue Nov 15 16:28:53 CST 2016


The following gives Xcode 8.1 a very hard time. Eventually I get a Bad Access on the last line. I'm guessing it's a recursive call. Is there any way to call the default implementation from a "real" implementation?

protocol FooPro
{
	func fooFunc()
}

extension FooPro
{
	func
	fooFunc()
	{
		print("fooFunc default")
	}
}

class FooClass : FooPro
{
	func
	fooFunc()
	{
		(self as FooPro).fooFunc()
		print("fooFunc FooClass")
	}
}

let fc: FooPro = FooClass()
fc.fooFunc()


Thanks!


-- 
Rick Mann
rmann at latencyzero.com




More information about the swift-users mailing list