Great presentation! PATs are still something I’m wrapping my head around. It’s one of those things where when it works, you’re not exactly sure how but happy that it does work
I followed all the steps in the lab, but am curious how you would use the last (generic) function with different types of ScalarMultipliable3
’s:
func multiplyAllMultiples<T: ScalarMultipliable3>(values: [T], factor: Float) -> [T] { return values.map({ $0.times(factor) }) }
Swift doesn’t seem to like calling that function like so:
multiplyAllMultipliables([MyScalar3(value: 3), MyVector3(value: [2, 4])], factor: 2)
But works fine with:
multiplyAllMultipliables([MyScalar3(value: 2), MyScalar3(value: 4)], factor: 2)
I would have guessed that as long as I’m passing an array of ScalarMultipliable3
’s, the function would return the multiplied output.
Wondering if you can lend some insight on why that doesn’t seem to be the case.
Thanks again for the awesome presentation!
Hi Alexis,
Just looking at the video version of your talk. I’m trying to follow along. At 6:14 of the video you refer to a file that gives more context called RWDevCon2016-ProtocolOrientedProgramming.playground in the SourceAssets folder. I don’t see this file. The file that is there is causing an error when I try to open it. It’s called POPPastePlayground.playground and the error is “couldn’t load settings from contents.xcplayground” . Anyhow, any chance you could upload the file you refer to there. Seems kinda key.
Ok, never mind. I solved it. I did a showpackages and the playground was buried inside there. It seems to run after a couple of tries.