Questions tagged [xcplayground]

XCPlayground is a module for Swift Playgrounds that was introduced in XCode 6 and subsequently deprecated in Xcode 7.

Apple Documentation: Playground Support

Important

Playground Support behavior was previously defined in the XCPlayground module, which is deprecated in Xcode 7.

23 questions
7
votes
1 answer

How to change Xcode Playground's to particular Swift Version?

I tried a swift code that's working well in the playground but not in Xcode project. So I want to know how to change a Playground's particular swift version.
sparrowceg
  • 81
  • 6
6
votes
1 answer

Flickering UIView in Simulator running from a Playground

I'm running a playground, Xcode 6.3 (6D543q). Therefore Swift 1.2 The Playground imports XCPlayground. I'm creating a UIView and calling XCPShowView() to have it render in the Simulator instead of in the Playground. I'm also presenting a UIAlertView…
Cocoadelica
  • 3,006
  • 27
  • 30
5
votes
1 answer

files in Sources folder cannot access the other files' public classes or functions in Xcode playground

For the life of me I cannot find the solution anywhere, so it seems to me it is a Xcode playground bug. Within the Sources folder, despite me declaring a class as public, when I try to access the class from a separate file (within the Sources…
jaspeRRR
  • 51
  • 3
5
votes
1 answer

No axis shown in Xcode 7 playground

I try to plot sin wave in Xcode 7 playground. I have the following code (got from this post): import XCPlayground let sineArraySize = 64 let frequency1 = 4.0 let phase1 = 0.0 let amplitude1 = 2.0 let sineWave = (0..
pacification
  • 5,838
  • 4
  • 29
  • 51
4
votes
2 answers

Can I put multiple playground files into one Xcode workbook?

I am using Xcode Playgrounds to make tutorials about Swift. I was wondering, can I put multiple playground files into one Xcode workbook? I want one workbook with multiple playground tutorials in it.
4
votes
5 answers

How to get input from user using Swift in playground project in Xcode 8.2?

I am trying to get the dynamic input from user in playground for iOS but it's not working. I tried the following code but it didn't work. import Foundation import UIKit func input() -> String { var keyboard = FileHandle.standardInput var…
rajvir singh
  • 111
  • 1
  • 3
  • 9
4
votes
0 answers

Disable warning in Xcode Playgrounds

How do I disable the awful pop-under warning behavior in Playgrounds? Trying to code when this happens is pointless, since the entire frame moves with it. ....NSAnnoying!
l'L'l
  • 44,951
  • 10
  • 95
  • 146
3
votes
1 answer

Problem with SwiftUI and foreach on Xcode playground

i am trying to execute a simple code in SwiftUI but it shows error: Execution was interrupted, reason: signal SIGABRT. here is a code ` struct ContentView: View { let data = (1...100).map { "Item \($0)" } let columns = [ …
3
votes
0 answers

How to change or remove "Example" label on markdown rendered code block in playgrounds?

In Xcode Playgrounds, it is possible to write markdown and render the markdown properly using the Editor -> Show Rendered Markup option. In the markdown of the playgrounds, code blocks can be formatted by enclosing them with: ``` However, when the…
nburk
  • 22,409
  • 18
  • 87
  • 132
2
votes
2 answers

Linking pages in Swift Playgrounds [Xcode]

I am new to swift playgrounds and ran into some problems while making a swift playground in Xcode. This is my main Playground page import UIKit import PlaygroundSupport import SpriteKit let secondScene = Index() let master = FirstScene() let root =…
Divye Shah
  • 747
  • 1
  • 11
  • 24
2
votes
0 answers

"Playground execution failed" thrown when importing UIKit

I am trying to play around with UIKit in playgrounds and i have consistently found the following error: " Playground execution failed: expression failed to parse, unknown error * thread #1: tid = 0xc9c7, 0x00000001067253c0 TestexecutePlayground,…
ggthedev
  • 47
  • 8
2
votes
2 answers

Using Xcode Playground captureValue()

I'm using Playgrounds in Xcode 7.1 (beta 3) but having trouble with the captureValue() function: captureValue:withIdentifier: Captures a value to be displayed with the specified identifier in the timeline. Declaration public func…
Richard Stelling
  • 25,607
  • 27
  • 108
  • 188
1
vote
1 answer

Infix % operator works in Playground, but not in included Swift library

I'm trying to overload the % operator for doubles in Swift. I realize the reason that the two methods on the Double type exist, but truncatingRemainder()'s behavior works fine for my use case. I'm using Xcode Playgrounds to work through this problem…
rikitikitavi
  • 139
  • 13
1
vote
0 answers

Accessing Resources in Swift PlaygroundBook

I am having trouble accessing images which I have stored in a sub directory in the PrivateResources Folder of my Swift Playgroundbook. I'm trying to access the following images. I have tried Bundle.main.path(forResource: "img_1", ofType: "jpg",…
ryandu
  • 617
  • 8
  • 17
1
vote
1 answer

Select SwiftUI cell in Popover

I am trying to make a popover in SwiftUI using a UIHostingController with a list that can be tapped. First, the user name and password should be filled in, and then the user role should be tapped in the list, and the popover should be dismissed when…
Ivan C Myrvold
  • 680
  • 7
  • 23
1
2