exercism / swift

Exercism exercises in Swift.
https://exercism.org/tracks/swift
MIT License
114 stars 159 forks source link

Add support for Apple iOS playgrounds #203

Open masters3d opened 8 years ago

masters3d commented 8 years ago

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 commented 7 years ago

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.

dylanbeadle commented 7 years ago

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.

masters3d commented 6 years ago

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