Been using Xcode's Download Container for a short time, and at first there were no issues.
But lately, it doesn't always download all the files from my iPhone to the Mac. Sometimes cleaning the build folder works, other times not.
As well, the same happens whether I am connected to my iPhone via cable, or wifi.
Has anyone else had this issue?
Post
Replies
Boosts
Views
Activity
While running Swift's SpeechRecognition capabilities I get the error below. However, the app successfully transcribes the audio file.
So am not sure how worried I have to be, as well, would like to know that if when that error occurred, did that mean that the app went to the internet to transcribe that file? Yes, requiresOnDeviceRecognition is set to false.
Would like to know what that error meant, and how much I need to worry about it?
Received an error while accessing com.apple.speech.localspeechrecognition service: Error Domain=kAFAssistantErrorDomain Code=1101 "(null)"
Am new enough to SwiftUI that I that are still some concepts that confuse me. Case in point: .background
The code below is meant to detect when the user drags their finger over different areas, in this case three different size circles placed over each other.
The code works, but I get lost trying to figure out how the logic works.
.background calls a function that's a view builder, yet doesn't an actual view? Unless Color.clear is the view it's returning?
I have more questions, but might as well start with .background since it comes first? I think?
Thanks
import SwiftUI
struct ContentView: View {
@State private var dragLocation = CGPoint.zero
@State private var dragInfo = " "
@State private var secondText = "..."
private func dragDetector(for name: String) -> some View {
GeometryReader { proxy in
let frame = proxy.frame(in: .global)
let isDragLocationInsideFrame = frame.contains(dragLocation)
let isDragLocationInsideCircle = isDragLocationInsideFrame &&
Circle().path(in: frame).contains(dragLocation)
Color.clear
.onChange(of: isDragLocationInsideCircle) { oldVal, newVal in
if dragLocation != .zero {
dragInfo = "\(newVal ? "entering" : "leaving") \(name)..."
}
}
}
}
var body: some View {
ZStack {
Color(white: 0.2)
VStack(spacing: 50) {
Text(dragInfo)
.padding(.top, 60)
.foregroundStyle(.white)
Text(secondText)
.foregroundStyle(.white)
Spacer()
ZStack {
Circle()
.fill(.red)
.frame(width: 200, height: 200)
.background { dragDetector(for: "red") }
Circle()
.fill(.white)
.frame(width: 120, height: 120)
.background { dragDetector(for: "white") }
Circle()
.fill(.blue)
.frame(width: 50, height: 50)
.background { dragDetector(for: "blue") }
}
.padding(.bottom, 30)
}
}
.ignoresSafeArea()
.gesture(
DragGesture(coordinateSpace: .global)
.onChanged { val in
dragLocation = val.location
secondText = "\(Int(dragLocation.x)) ... \(Int(dragLocation.y))"
}
.onEnded { val in
dragLocation = .zero
dragInfo = " "
}
)
}
}
#Preview {
ContentView()
}
Is there a Finder type app that will read through my iPhone files?
I’m working on a app that records audio files to my iPhone, and it would be much easier if I could find an app where I could scroll through the files on my iPhone from my desktop as opposed to doingit on the iPhone itself.
Correct me if I'm wrong, but with the latest version of Xcode (15.x) you can no longer add files to the iPhone simulator by dragging them into the the Files app.
I also tried to share the files from my Mac desktop to the simulator. But after selecting the simulator, absolutely nothing happened.
So I had to do it the long way:
Add a folder to the simulator with a unique name, in the Files app
Get the document path, print(URL.documentsDirectory.path())
Back track into the folder structure till I find that folder
cp the files to that folder
Please tell me that there is a way that I haven't found on Google, or that I somehow was doing what the Apple dox suggested, but missed a step.
Before Xcode 15, when I could access the info.plist file, I was able to add exceptions to the App Transport Security Settings so I could connect with my home server, which has no HTTPS, just HTTP.
But in Xcode 15 I have no idea, not can I buy a clue with google, on how to do this.
Please help!
Thanks
p.s. I should probably add that one site mentioned going to the Target section of your project allows easy access to info.plist. Yet for some strange reason, there is no item in Targets, which is odd, as I can debug my. project.
Before Xcode 15, when I could access the info.plist file, I was able to add exceptions to the App Transport Security Settings so I could connect with my home server, which has no HTTPS, just HTTP.
But in Xcode 15 I have no idea, not can I buy a clue with google, on how to do this.
Please help!
Thanks
p.s. I should probably add that one site mentioned going to the Target section of your project allows easy access to info.plist. Yet for some strange reason, there is no item in Targets, which is odd, as I can debug my. project.
Can I open two separate Xcode windows with the same project ?
I have multiple monitors, so would love to be able use them to view different files of the same project.
Is there a way?
Is it possible to switch to a new View without using NavigationStack or NavigationLink or NavigationView?
I know I can do it with a Bool, which either shows the second view, or the first, and then toggles the Bool.
But can't I do something like this? Which obviously doesn't work.
struct BasicButton: View {
var buttonLabel = "Create User"
var body: some View {
Button {
CreateUser() //another SwiftUI view, not a function
} label: {
Text(buttonLabel)
}
}
}
So like the title says, when I start up Xcode the preview won;t work till I run a debug session using the simulator.
Sometimes the debug session is unable to start the simulator, which I can start manually then run a debug session.
Once all the above is done, preview works.
Any idea what is causing this behavior?
Is there any app out there that lets you browse through a CoreData database? When I first started to learn Swift, an app called Liya seemed to work. But alas, no longer.
it would just make it easier if there was anything out there that let you browse the data directly.
Thanks
Would like to be able to bring up the iOS keyboard in a SwiftUI view without having to use a TextField? The goal would be to capture each keyup, or keydown, using .onKeyPress
While I thought I could create a TextField not visible to the user, was hoping there was a cleaner way.
I am trying to watch an @EnvironmentObject in the Xcode debugger and it comes up as an Invalid Expression in the View pane. If I want to view it, I need to declare it as a local variable and then assign it the value of the passed in @EnvironmentObject.
While not impossible, it's a lot of work. Or maybe I am doing something incorrectly and this is a symptom of that? Would like to resolve this.
encl: Example code & Screenshot, where choice is the passed/unviewable EnviornmentObject and ch is the local variable I use to view it in the debugger
Project "TestingApp"
File: TestingApp
import SwiftUI
@main
struct TestingApp: App {
@StateObject private var choice = Choices()
var body: some Scene {
WindowGroup {
ContentView()
.environmentObject(choice)
}
}
}
File: Choices
import Foundation
@MainActor
class Choices: ObservableObject {
@Published var aChoice = 1
@Published var bChoice = 2
}
File: ContentView
import SwiftUI
struct ContentView: View {
@EnvironmentObject private var choice: Choices
var body: some View {
VStack {
let ch = choice
Text("\(choice.aChoice)")
.font(.largeTitle)
.padding(.bottom)
Text("2")
.font(.largeTitle)
}
.padding()
}
}
#Preview {
ContentView()
}
Someone showed me the code below, when I was trying to figure out how to detect which views were being intercepted by one continuous DragGesture.
It works, but I would like to find a tutorial whre I can learn what's going on here.
From what I can tell, the background modifier is a closure, that calls a function which has a GeometryReader which returns a view.
I've Googled .background as a closure in swiftui and still can't find any form of tutorial that discuss what is going on here. Not looking for the answers, looking to learn.
Thank you
struct ContentView: View {
@State private var dragLocation = CGPoint.zero
@State private var dragInfo = " "
private func dragDetector(for name: String) -> some View {
GeometryReader { proxy in
let frame = proxy.frame(in: .global)
let isDragLocationInsideFrame = frame.contains(dragLocation)
let isDragLocationInsideCircle = isDragLocationInsideFrame &&
Circle().path(in: frame).contains(dragLocation)
Color.clear
.onChange(of: isDragLocationInsideCircle) { oldVal, newVal in
if dragLocation != .zero {
dragInfo = "\(newVal ? "entering" : "leaving") \(name)..."
}
}
}
}
var body: some View {
ZStack {
Color(white: 0.2)
VStack(spacing: 50) {
Text(dragInfo)
.foregroundStyle(.white)
HStack {
Circle()
.fill(.red)
.frame(width: 100, height: 100)
.background { dragDetector(for: "red") }
Circle()
.fill(.white)
.frame(width: 100, height: 100)
.background { dragDetector(for: "white") }
Circle()
.fill(.blue)
.frame(width: 100, height: 100)
.background { dragDetector(for: "blue") }
}
}
}
.gesture(
DragGesture(coordinateSpace: .global)
.onChanged { val in
dragLocation = val.location
}
.onEnded { val in
dragLocation = .zero
dragInfo = " "
}
)
}
}
Using Xcode 15.0.1
The playground, for the code below, has been in "Launching ok" for over two minutes. Anything that I should look into? A little mind boggling actually.
import UIKit
var msg = "Hello World"
print ("\(msg)")