swift-graphics icon indicating copy to clipboard operation
swift-graphics copied to clipboard

Example code doesn't work

Open TOertel opened this issue 5 years ago • 1 comments

Trying to use an external package with Swift for the first time, so maybe it's just my lack of experience...

I figured out how to add the package (with help from bug #1 ) , but the code as written causes: error: cannot find 'Vec2' in scope graphics.draw(Text("Test", at: Vec2(x: 0, y: 15)))

If I need another library, including the imports explicitly in the example might be useful for others.

TOertel avatar Oct 12 '20 23:10 TOertel

Yes, you need the swift-utils library (which is where Vec2 comes from) and add the following imports:

import Graphics
import Utils

I agree that the example isn't documented very well yet, this library was originally just a byproduct of factoring out a few modules from a larger project of mine, hence it was primarily written with my own use cases in mind. I am glad someone else (like you) finds it useful, though. :)

fwcd avatar Oct 13 '20 08:10 fwcd