swift icon indicating copy to clipboard operation
swift copied to clipboard

Add support for Apple iOS playgrounds

Open masters3d opened this issue 8 years ago • 3 comments

Right now XCTest is not included in iOS since it is part of the sdk but not the OS in iOS. If we want to support xctest code in iOS we need to build an iOS version to run as a framework. https://github.com/apple/swift-corelibs-xctest

This may be impossible to do right now, we could do is fake the XCTest framework by just running the test code on the web.

masters3d avatar Nov 16 '16 01:11 masters3d

This has support for playgrounds https://github.com/kylef/Spectre

we would need to create boiler plate templates that could create xctest and spectre for playgrounds code we could use the python gby https://github.com/apple/swift/blob/2a25a8c14fecaaca68d881fcbcba71a85bcc1e9d/validation-test/stdlib/CollectionCasts.swift.gyb

or a stencil template using sourcery https://github.com/krzysztofzablocki/Sourcery/blob/master/Templates/AutoMockable.stencil

The adantage of sourcery is that it alreay has some templates for linux declaration of xctest.

masters3d avatar Feb 11 '17 00:02 masters3d

I've had some success using https://github.com/Liquidsoul/XCTestPlayground in an iOS Playground , but not all asserts are supported property, so some tests in exercises fail. I also have a build script that automates the download of all exercises and creates the playgroundbook file used in iOS playgrounds.

I'm exploring if we can use https://github.com/apple/swift-corelibs-xctest/blob/master/Sources/XCTest/Public/XCTAssert.swift for the assert functions to avoid the issues. I'll update this thread if I have success.

dylanbeadle avatar Oct 08 '17 06:10 dylanbeadle

Now you can subscribe to playgrounds from your favorite third-party creators, then browse and download their content directly within Swift Playgrounds.

https://itunes.apple.com/us/app/swift-playgrounds/id908519492?mt=8

masters3d avatar Jan 24 '18 20:01 masters3d