Post not yet marked as solved
The Text("Top")/ Text("Bottom") not my want effect.
Post not yet marked as solved
Can you post the Whole tea time code, all of it?
Post not yet marked as solved
I’m using Swift Playground on my iPad 9th gen. I’m trying to implement a website that uses camera inside of the Swift app. Can someone help me out pointing to what should I use to access the live video?
Post not yet marked as solved
Hello people,
I'm new in Swift and Xcode, I'm learning and until now everything is okay and fantastic, however I have an issue with the next exercise.
Lab - Enumerations.playground-App Exercise - Swimming Workouts
In the last part of the exercise is written the next:
Inside save() write a switch statement that switches on the instance's stroke property, and appends self to the proper array.
I don't understand what means "appends self to the proper array", I tried everything and can not found the solution, someone can explain in more detail what this mean?
Thank you all in advance.
Ernesto.
Post not yet marked as solved
How do I download swift playgrounds?
Post not yet marked as solved
Using Version 14.0 beta (14A5228q) on Monterey 12.4
I am trying to follow the 'Meet Swift regex' presentation dated 7 June but I have stumbled on the most basic of errors that I cannot get around.
At 3:56 in the video, the following line of code is shown
let transaction = "DEBIT 03/05/2022 Doug's Dugout Dogs $33.27"
let fragments = transaction.split(separator: /\s{2,}|\t/)
// ["DEBIT", "03/05/2022", "Doug's Dugout Dogs", "$33.27"]``
The '/' of the separator string generates the error:
error: cannot convert value of type 'Regex' to expected argument type 'String.Element' (aka 'Character')
I am embarrassed but also stuck on the simple issue and I cannot figure out what I am missing.
TIA
Chris
Post not yet marked as solved
Hi,
I am a computer science teacher at secondary schoool.
Would it be possible to have the entire code of this app please?
I am going to implement something similar for my students.
Kind Regards,
Federico
Post not yet marked as solved
I follow along with the video in the WWDC2022 session, "Build your first app in Swift Playgrounds". I construct the Tea Time app as demonstrated in the video. When I come to the part about adding the microphone capability in the App Settings, Playground crashes and disappears. I click the "+" button for the capability, for a fraction of a second I see a modal about the microphone, and then it crashes.
I don't know what to do.
How do I fix this problem and add the capability?
Post not yet marked as solved
I am a beginner and i am working on the Scrumdinger tutorial . this message keeps popping up "Cannot infer contextual base in reference to member 'trailingIcon'" I do not know how to fix it.
Here is my code
import SwiftUI
struct CardView: View {
let scrum: DailyScrum
var body: some View {
VStack(alignment: .leading){
Text(scrum.title)
.font(.headline)
.accessibilityAddTraits(.isHeader)
Spacer()
HStack {
Label("(scrum.attendees.count)", systemImage: "person.3")
.accessibilityLabel("(scrum.attendees.count) attendees")
Spacer()
Label("(scrum.lengthInMinutes)", systemImage: "clock")
.accessibilityLabel("(scrum.lengthInMinutes) minute meeting")
.labelStyle(.trailingIcon)
}
.font(.caption)
}
.padding()
.foregroundColor(scrum.theme.accentColor)
}
}
struct CardView_Previews: PreviewProvider {
static var scrum = DailyScrum.sampleData[0]
static var previews: some View {
CardView(scrum: scrum)
.background(scrum.theme.mainColor)
.previewLayout(.fixed(width: 400, height: 60))
}
}
Any ideas?
Post not yet marked as solved
I have been watching a session called “Meet desktop-class iPad” and wondered what would be the easiest way to implement it? I am on Swift Playgrounds iPad Pro.
Post not yet marked as solved
I want to make an app and become a real developer but I can’t because I only have $140 and I can’t find any iPads or MacBooks under $140. I could only find android tablets. Can anyone help me find an iPad or MacBook under $140 or a Swift Playgrounds alternative for iOS? Please I need help!
Post not yet marked as solved
Hello :)
My iOS project does not work with SwiftUI Preview in Xcode 14 beta. The project builds and runs fine, but Preview never works. The error message is as follows.
HumanReadableSwiftError
SettingsError: noExecutablePath(<IDESwiftPackageStaticLibraryProductBuildable:ObjectIdentifier(0x000060002ac3e880):'AppCenterCrashes'>)
I do use the AppCenterCrashes dependency in my project. But I'm not sure if this error message is accurate, because sometimes it reports other packages.
After I executed Generate Report, I found the following error in SerializationErrors.txt.
Error Domain=NSCocoaErrorDomain Code=516 "“LogCaffeineIntent.swift” couldn’t be linked to “Intermediates” because an item with the same name already exists." UserInfo={NSSourceFilePathErrorKey=/Users/gong/Library/Developer/Xcode/DerivedData/.../Build/Intermediates.noindex/HiCoffee.build/Debug-iphonesimulator/IntentsExtension.build/DerivedSources/IntentDefinitionGenerated/Intents/LogCaffeineIntent.swift, NSUserStringVariant=(
Link
), NSDestinationFilePath=/var/folders/lv/58r5dhv52j779_qn41gnq4c80000gn/T/previews-diagnostics-20220608-144336/Intermediates/LogCaffeineIntent.swift, NSFilePath=/Users/gong/Library/Developer/Xcode/DerivedData/.../Build/Intermediates.noindex/HiCoffee.build/Debug-iphonesimulator/IntentsExtension.build/DerivedSources/IntentDefinitionGenerated/Intents/LogCaffeineIntent.swift, NSUnderlyingError=0x600033223810 {Error Domain=NSPOSIXErrorDomain Code=17 "File exists"}}
The problem seems to be related to the Intent generation code. I don't know how to fix it yet.
Post not yet marked as solved
Was doing the tutorials from Swift Playgrounds new lesson "Keep going with Apps" and on the "Bindings" chapter was asked to put a ColorPicker view.
To see the color options I should run the app instead of seeing it in the preview. I tried to do that but I don't get a response from Playgrounds...
Has someone had the same problem while doing this lesson?
I've been trying to use Swift Playgrounds to play with some basic code and have been encountering an infuriating issue.
When I switch into the Playgrounds window from another program (by swiping left or right after writing notes in another program), I can no longer type into the Playgrounds window. Clicking anywhere to put my cursor in the editor just won't let me type.
In order to be allowed to type again I have to first click one of the code suggestion options from the bottom of the screen.
After that I can change and overwrite freely.
It is driving me crazy.
Post not yet marked as solved
import SwiftUI
import PlaygroundSupport
struct ProgressView: View {
let gradientColors: [Color] = [Color( colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)), Color( colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0))]
let sliceSize = 0.35
let progress: Double
private let percentageFormatter: NumberFormatter = {
let formatter = NumberFormatter()
formatter.numberStyle = .percent
return formatter
} ()
init(_ progress: Double = 0.3) {
self.progress = progress
}
var body: some View {
GeometryReader { geometry in
ZStack {
Group {
Circle()
.trim(from: 0, to: 1 - CGFloat(self.sliceSize))
.stroke(self.strokeGradient, style: self.strokeStyle(with: geometry))
.opacity(0.5)
Circle()
.trim(from: 0, to: 1 - CGFloat(self.sliceSize)) * CGFloat(self.progress))
.stroke(self.strokeGradient, style: self.strokeStyle(with: geometry))
} .rotationEffect(.degrees(90) + .degrees(360 * self.sliceSize / 2))
}
}
}
}
Hi there,
Before I post this in here, I have quick googled it but didn't found accurate answer.
I'm in Chapters 2 the end of Parameters, I just want 3 rows's Character to solve the puzzle at same time, but I really don't know what way can do it, if I line the func one by one, they just complete one by one. Could you have any ideas, thanks a lot~
Post not yet marked as solved
Another solution for easy understanding, hope it helps.
var gemCounter = 0
var switchCounter = 0
while gemCounter >= switchCounter {
moveForward()
if isBlocked && isBlockedLeft {
turnRight()
}
while isOnGem {
collectGem()
gemCounter += 1
}
while isOnClosedSwitch && switchCounter != gemCounter {
toggleSwitch()
switchCounter += 1
if switchCounter == gemCounter {
switchCounter += 1
}
}
}
Post not yet marked as solved
I am trying to build an app where there is a premium version and a free version. When someone purchases the premium version, I want a new screen to show. How do I do this.
Code
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Link(destination: URL(string: "https://www.icloud.com/sharedalbum/#B0tG4Tcsmu6ATjR")!) {
VStack {
Image(systemName: "paperplane")
.font(.largeTitle)
Text("Click here to get wallpapers!")
.accentColor(Color.white)
.background(Color.black)
}
}
}
}
}
Premium Code
import Foundation
import SwiftUI
struct Premium: View {
var body: some View {
VStack {
Link(destination: URL(string: "https://www.icloud.com/sharedalbum/#B0tG6XBubu4jvR9")!) {
VStack {
Image(systemName: "plus")
.font(.largeTitle)
Text("Click here to get Premium wallpapers!")
.accentColor(Color.white)
.background(Color.black)
}
}
}
}
}
Hello!
I am a new to programming and developing and I have a question:
I tried using Xcode and copied my code from Playgrounds into my Xcode Project.
But now it says 50 times "Cannot find (...) in scope."
In Playgrounds my code worked. What am I doing wrong?
Thank you very much!
Post not yet marked as solved
IPad Playgrounds has started to routinely crash on me. It started crashing while I was trying to work with protocol meta types, so I thought something about that feature was doing it, but I’ve moved onto other projects, or even brand new ones and Playgrounds keeps crashing.
It seems to have something to do with comments. If I’m just editing code it’ll keep going and the preview will update, but if I start to edit a comment I’ll see the compiler begin to spin and it crashes. I can post a video later if needed.
I’ve rebooted the device and it’s still crashing. What do I do? If I delete and reinstall Playgrounds will all my projects stay there or do I need to back them up somehow?