Boogie Bot does not work in Xcode 9

In lesson 7 of Swift learning the Boogie Bot does not work properly.

You get the following error:

error: no such module '_7_BoogieBot_Sources' import _7_BoogieBot_Sources

That is because with Xcode 9 the macOS 10.13 SDK NSGraphicsContext.current has changed from a class method to a class property.

How to fix it

To solve this problem  find the error log and change the value the code NSGraphicsContext.current()? to NSGraphicsContext.current.

Then go to if (savePanel.runModal() == NSFileHandlingPanelOKButton) and change it into if (savePanel.runModal() == NSApplication.ModalResponse.OK).

Finally solve the pi issue you get with follwing error:

'M_PI_4' is deprecated: Please use 'Double.pi / 4' or '.pi / 4' to get the value of correct type and avoid casting.

Just replace M_PI_4 with Double.pi.

Hope I could help you. If you have any questions, just leave a comment.

Get the famous Schroedinger’s Cat Shirt here