Reputation: 53
In an Xcode project, files in the left Project Navigator can be organized into virtual (and actual) folders (Groups). In Playground, while a new folder can be added, it does not seems to be possible to do the same. Can it be done in Playground?
And if you can't, what would be similar?
Upvotes: 2
Views: 496
Reputation: 3787
You can create an Xcode Project with a built in Playground, information found here
Optional: Control-click on ViewController.swift in the Project Navigator1 and click New File… and then iOS -> Source -> Swift File. Call it SuperClass.swift and make sure SuperProject and SuperProjectiOS are checked under Targets. Replace the contents of this file with this: import Foundation
class SuperClass{ func greetMe() -> String{ return "Hello" } }
Select the framework target (SuperPlaygroundiOS) in the File Inspector for any other files you want to access from your new playground.
Select SuperPlaygroundiOS > iPhone 6S Plus beside the Play/Stop buttons, then Product -> Build.
In SuperProject.playground, type the following at the top of the file:
@testable import SuperPlaygroundiOS
If you did step #5, you can now type this at the bottom of the file too.
SuperClass.greetMe()
Upvotes: 1