How to use a custom framework with a playground in Xcode 9

I am trying to use a custom structure on a playground, as described in this Apple documentation:

http://help.apple.com/xcode/mac/9.0/#/devc9b33111c

However, I cannot get the playground to recognize the framework ( https://github.com/gk-brown/MarkupKit ). This is the 64-bit Objective-C framework that defines the module.

Here is what I tried:

  • Create a new "single view" playground
  • As indicated in the document, open the playground and choose File> Save As Workspace
  • Close the playground
  • Open the workspace containing the playground
  • Attempting to select a file> Add files to [Workspace Name]

The menu item is actually called "Add Files ..." and is disabled. I can get around this by opening the Navigator panel and selecting Project Navigator. The menu item changes to "Add files to TestPlayground" and becomes enabled.

Moving as indicated in the document:

  • Go to the directory containing the framework, select the framework and click "Add"
  • In the editor, open the required source file for the playground
  • Add an import statement for the framework (for example, "import MarkupKit")

The following error is displayed on the console:

error: TestPlayground.playground:5:8: error: no such module 'MarkupKit' 

The document further notes that the workspace must contain at least one active schema that creates the target. However, adding a project to the workspace and creating it does not solve the problem. The playground still cannot see the frame.

Based on what I read elsewhere on SO, it seems like this should be possible. However, most of the information I found is 2-3 years old and may be outdated. The frame is a universal binary, and I tried to trim it with lipo, as suggested in some other posts. In particular, I did this:

https://github.com/gk-brown/MarkupKit/wiki/Deployment

Unfortunately, this did not help.

Any suggestions would be much appreciated.

+4
source share
1 answer

Your steps look good, but Only the missing part that I see here adds an empty .swift file to the project.

enter image description here

This is actually compiled below the project, therefore, after this structure is ready for import to the playground.

0
source

Source: https://habr.com/ru/post/983961/


All Articles