Xcode autocomplete does not work in Sources folder of Swift playgrounds
In order to enable autocompletion, you can embed your Playground in a regular Xcode project (e.g. an iOS application). I recommend creating a dummy project for that purpose. Simply drag and drop your playground in this dummy project and make sure to check "Add to target".
Then you can navigate to
Target -> Build Phases -> Compile Sources -> + -> Add other
and add all the files from your source folder. Please note, that you don't need to actually copy the files, a reference is enough for this purpose.
After this process all your source files are built against this dummy target and you can use autocompletion as usual. As far as I know, this is the best practice for debugging Playgrounds right now. Anyway I am curious, if there is an easier way to achieve that.
Xcode playgrounds can't access swift files in Sources folder
You have to add public access attribute to your classes, methods and properties in source folder to make them accessible from main playground file as they treated as separate module by compiler
Xcode 9 Autocomplete Not Working 100% - Partially Working
Deleting the DERIVED DATA folder seemed to fix my issue. Thanks to this post: swift println() not showing autocomplete options while writting code
Xcode 9 Autocomplete Not Working 100% - Partially Working
Deleting the DERIVED DATA folder seemed to fix my issue. Thanks to this post: swift println() not showing autocomplete options while writting code
Sources referencing each other in XCode Playgrounds
Add the public
attribute to the classes, methods, and properties that you want to access in other playgrounds. This should solve your problem:
You have to add public access attribute to your classes, methods and properties in source folder to make them accessible from main playground file as they treated as separate module by compiler
Update:
I found this thread, which although is not on this topic specifically I believe answers the question, here is what the accepted answer says:
They cannot. Playgrounds are self-contained. This will hopefully change in the future.
Edit: As of Xcode 6.3, Playgrounds can now contain supporting code. They still cannot see other code in the same project, but code can be added to the support folder of a Playground that can be used from within the playground. See the Swift blog for more info.
So, as I said before, thing is the sources folder can be accessed, but not thing in other playgrounds.
Xcode 9 Autocomplete Not Working 100% - Partially Working
Deleting the DERIVED DATA folder seemed to fix my issue. Thanks to this post: swift println() not showing autocomplete options while writting code
Can't visualize UIBezierPath in Playground
I would say this is a bug in Xcode 8.3. It gave me the same result in Xcode 8.3. I just tried your code in Xcode 8.2.1 and it draws a line in the quick look window.
This is something that should be filed as a bug report to Apple.
In the meantime, either use an older version of Xcode, or embed the bezier path in a view and quick look the view.
Related Topics
Coredata Crash Error Xcode 11 Beta, iOS 13 Beta
Dispatch_Once_T' Is Unavailable in Swift: Use Lazily Initialized Globals Instead
Duplicating a Particle Emitter Effect in Sprite Kit
Swift: How Can String.Join() Work Custom Types
Swiftui: Dismiss View Within MACos Navigationview
Convert or Cast Object to String
Why Does My Pfanalytics Not Have Trackappopenewithlaunchoptions Function? (iOS Swift)
Swift Combine - Wait for All Publishers
Present Actionsheet in Swiftui on iPad
Perform a Segue Programmatically
How to Implement Hash(Into:) from Hashvalue in Swift
One-Way Platform Collisions in Sprite Kit
Can't Create an Array of Types Conforming to a Protocol in Swift
Resetting Zone Allocator with Allocations Still Alive
Compiler Error: Invalid Library File - Corelocation
Interactivepopgesturerecognizer Corrupts Navigation Stack on Root View Controller