From the Swift REPL, how do I get a list of available modules?
From the Swift REPL, I can import framework modules like Foundation by doing
What command can I give on the REPL that will produce a list of all the modules which are available to be imported?
Just to be really clear what I’m trying to understand. On the REPL, if I type the words “import Foundation” then I can access the Foundation types, constants, etc.. If I type the words “import CoreGraphics” then I can access CoreGraphics. If I have the 3rd party library OptionKit installed, then typing “import OptionKit” lets me use OptionKit. These are all modules which can be directly imported from the REPL.
Some modules or frameworks, however, cannot. For instance, if I type “import ParseOSX” from the REPL, I get an error, even though it is possible to do “import ParseOSX” from a standalone script.
What I want to understand is just, how do I determine the list of frameoworks or modules which I can import, from the REPL, by using the import command.
I’ve done a little searching and it seems like the only 3rd-party framework I’ve successfully imported from /Library/Frameworks, OptionKit, is also the only one with a .swiftmodule file. And all the importable Apple frameworks seem to have their own .swiftmodule files, which you can find by searching under /Application/Xcode.app.
So this suggests you can import at runtime only the framework with .swiftmodule files. But I’m not sure of this.
- Wait until swift for loop with asynchronous network requests finishes executing
- calling a parent uiviewcontroller method from a child uiviewcontroller
- “Reading from public effective user settings” in iOS 10
- Objective C Bridging Header for frameworks
- UICollectionView and Supplementary View crash
- Programmatically obtaining the IMEI or UDID of an iOS Device
Solutions Collect From Internet About “From the Swift REPL, how do I get a list of available modules?”
If you’re looking simply for the list, you might want to use:
:target modules list
That returns the full list of modules. Hope this help.
- How to display a base64 image within a UIImageView?
- Return a word-wrapped NSString from a longer NSString
- UITextField Example in Cocos2d
- How do I set up a simple delegate to communicate between two view controllers?
- Recognize Black patterns appearing on the four corners of the image ios using opencv or some other technique
- Magical Record save in background
- Updating UILabel in the middle of a for() loop
- NSLocalizedString with variables Swift
- Make REST API call in Swift
- iOS detect if user is on an iPad
- Apple Watch: Status bar not visible after presenting a modal screen from page based navigation
- It is possible to continuously update the UILabel text as user enter value in UITextField in iOS
- cocoa:webView which have hyperlinks to add the ` target = “ _blank ”` can not be opened
- Phonegap App : External URL don't open in InApp Browser of IOS
- Download Xcode documentation sets manually