Workaround thanks to the Sources folder of the playground.
You can either use the menu to add external files:
Create> Add Files To Sources
or go to the menu:
View> Navigators> Show Project Navigator
and release the .swift file in the Sources folder.
To be accessible, your code in this folder must be publicly available:
public class PlayGround { public class func count() { var count = 0 for i in 1...10000 { count++ } } }
Then, as usual, on the playground itself:
let startTime = NSDate() PlayGround.count() let endTime = NSDate() let interval = endTime.timeIntervalSinceDate(startTime)
source share