swift-playground Questions
1
So I want to make a swift file in the sources folder that imports UIKit, but it says that no such module 'UIKit', why is it like that?
Can someone help?
Empire asked 22/4, 2022 at 18:12
5
Solved
I'm trying to add a breakpoint in the line # gutter, but no breakpoint is added when I do this in the playground. Is this possible or is there another way to set breakpoints in the playground?
Hushhush asked 17/4, 2015 at 22:12
7
Solved
I'm new in the Swift world.
How can I converting a String with a comma to a String with a decimal?
The code work's fine with a dot (.)
The problem is when I'm using a comma (,) ... with: var pri...
Ander asked 4/2, 2015 at 5:5
2
I've upgraded to MacOS 11 (Big Sur) Beta 4. And Xcode 12 beta 4.
I have a Swift playground with Combine publishers:
Just([1,2,3])
.setFailureType(to: Error.self) // Make the compiler pick up new A...
Shalne asked 6/8, 2020 at 13:17
1
I've typed a very simple error into an Xcode playground:
import UIKit
var greeting = "Hello, playground"
["foo", "bar"][2] // error
The console correctly prints th...
Dannielledannon asked 15/12, 2021 at 22:44
7
Solved
I want my function to calculate the average of my Double type array. The array is called "votes". For now, I have 10 numbers.
When I call the average function to get the average of the array vote...
Emiliaemiliaromagna asked 2/2, 2015 at 22:38
0
I had just recently downloaded xcode and everytime I write code and come to an error, I would fix the error but the console and preview do not update. It down not change the error live will not rer...
Wellbred asked 8/6, 2023 at 16:43
1
Using Playgrounds 4.3 on macOS 13, I am trying to save a file, in this case an JSON file, to disk.
As an example I use this code, so it should work but not in Playgrounds.
Are there setting that i ...
Poirer asked 11/4, 2023 at 8:46
5
Solved
I'm experimenting code from https://alanquatermain.me/programming/swiftui/2019-11-15-CoreData-and-bindings/
my goal is to have DatePicker bind to Binding< Date? > which allow for nil value ins...
Valuate asked 10/12, 2019 at 17:45
6
I know that to program in STDIN and STDOUT, we need to make an command line project in Xcode.
But how do I take a standard input in playground.
Whenever I try to run such code in playground
var...
Warrant asked 13/2, 2016 at 13:15
5
Solved
Can i import Swift Package to my Playground that is in my workspace? I've already read the answer, but i think it's outdated, because now we can use Swift Packages in iOS projects.
Babbitt asked 22/2, 2020 at 13:51
2
The following error was invoked when I wrote case 2841001 ... 393200 : I figured out my error (having an extra digit in the first number, copy paste error), but I would love to learn how to use "th...
Rebbeccarebe asked 10/4, 2016 at 9:33
0
Xcode 14, in a playground (with import UIKit):
let uuid = UUID().uuidString
let boundary = "Boundary-\(uuid)"
Fine. But uuid isn't really needed, so let's collapse that into a single lin...
Marshmallow asked 18/9, 2022 at 15:6
4
I created a Swift Playground on my iPad and did all of my graphics positioning on the iPad simulator. Does anyone know how to edit the size of the Xcode playground simulator? Thanks in advance.
Canales asked 2/4, 2017 at 0:25
5
Solved
In the next code I'm trying to call the deinit method releasing all the references to the Person Class instance Mark but the deinit is never called. Why?
class Person{
let name:String
init(na...
Good asked 23/6, 2014 at 10:13
10
Solved
How do I make a UIImageView with rounded corners on a Swift iOS Playground?
Inside it needs to be filled with a color.
Margarettamargarette asked 24/8, 2014 at 20:43
1
I want to add an SKScene (.sks) to my Swift Playground App project (.swiftpm) on Xcode but when I add it to the project navigator I get the following error:
found 1 file(s) which are unhandled; exp...
Legend asked 6/4, 2022 at 19:53
7
Playground shows the error below and even after restart it is still not working. Any idea how to solve this?
Error: Failed to prepare for communication with playground for an unknown reason.
Anapest asked 30/9, 2021 at 5:40
6
If we have, for example, situation like this:
var myString = "Today was a good day"
What is the best way to return the first word, which is "Today"? I think mapping should be applied, but not s...
Hageman asked 23/9, 2016 at 18:24
2
Solved
In blog posts like https://useyourloaf.com/blog/adding-playgrounds-to-xcode-projects/, or the kickstarter source code http://github.com/kickstarter/ios-oss they add playground to xcode projects in ...
Connote asked 1/12, 2017 at 9:2
16
Solved
When I use the for loop in Playground, everything worked fine, until I changed the first parameter of for loop to be the highest value. (iterated in descending order)
Is this a bug? Did any one el...
Diamonddiamondback asked 1/7, 2014 at 10:59
20
I waited long time but my playground project is not showing result on right side bar
I am using right code but still right bar is not updating i don't know what is the problem i tried lot of time.
...
Balalaika asked 6/10, 2014 at 6:34
2
Solved
I'm trying to run this async function on Xcode Playground:
import Foundation
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
enum NetworkingError: Error {
case in...
Slavish asked 16/6, 2021 at 14:18
3
I'm new to IOS development and I have started with the swift language.
I'm trying to get the value from two text fields and convert those two text fields into json and send that json to the server...
Howsoever asked 26/12, 2014 at 8:10
5
There seems to be a strange issue with iOS Playgrounds where NSUserDefaults always returnsnil instead of the actual value.
In an iOS Playground the last line wrongly returns nil.
import UIKit
le...
Communitarian asked 3/7, 2015 at 15:28
1 Next >
© 2022 - 2025 — McMap. All rights reserved.