Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you import Metal in Swift?

Whenever I try to import Metal in my Swift file or a playground, Xcode says "No such module 'Metal'". Is this a Beta 1 bug?

like image 520
Kishyr Ramdial Avatar asked Jun 06 '14 16:06

Kishyr Ramdial


Video Answer


1 Answers

This is a platform issue, not a Swift issue. If you manually inspect the platform SDKs inside Xcode, you'll see that the Metal.framework only exists in the iOS8 SDK. That means you can only link to the framework when your code is going to run on an actual iOS device, and since playgrounds don't run on the device, there's no way to link to the framework.

like image 58
Colin Avatar answered Oct 16 '22 11:10

Colin