Post not yet marked as solved
I’m having a very odd problem in which my URLSession response works the first time, but almost always fails on subsequent calls. It’s taken me forever to debug because I needed to examine the response headers to determine anything at all. I used Proxyman based on a recommendation from Donny Wals -- https://www.donnywals.com/debugging-network-traffic-with-proxyman/ -- and — as far as I can tell — the only differences between the calls is that the first call returns:
HTTP/1.1 200 OK
Date: Tue, 06 Jun 2023 14:06:08 GMT
Server: Apache
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Headers: Content-Type, Depth, User-Agent, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control
Vary: Accept-Encoding,User-Agent
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Content-Encoding: gzip
Set-Cookie: PHPSESSID=d10701af2da595b698c57f183e76a709; path=/
Upgrade: h2
Connection: Upgrade, Keep-Alive
Keep-Alive: timeout=5, max=100
Transfer-Encoding: chunked
While subsequent calls return different values for Keep-Alive and Connection (and they’re returned in a different order):
Second call same as first except:
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
Third Call same as first and second except:
Upgrade: h2
Connection: Upgrade, Keep-Alive
Keep-Alive: timeout=5, max=100
The subsequent calls also do not return the Set-Cookie value, and the Upgrade value appears sometimes but not others.
All three return 200 OK, but my code is failing on this step:
guard let (data, response) = try? await session.data(for: request),
let httpResponse = response as? HTTPURLResponse,
httpResponse.statusCode == 200
else {
logger.debug("Failed to receive valid response and/or data.")
throw MyError.missingData
}
This code is taken directly from the Earthquakes project at Apple (although I modified it slightly to send a POST to my API, which seems to work fine).
What's even more frustrating is that the second and third call immediately return the correct JSON data (all formatted fine, etc.) just like the first call, so I cannot understand why they fail.
I am completely stumped and hoping someone might have some idea of what I can do here, or even how I can debug better.
Thanks immensely for any help you can provide.
Post not yet marked as solved
I’m wondering if it’s possible to use SceneKit or GamePlayKit to handle physics etc and having SwiftUI to create the 3D content?
Post not yet marked as solved
Hi I upgraded my Mac to test the new os and iOS 17. But I have problems with the weather kit on the app.
WeatherKit enabled as app service and capability there was no issue with the iOS 16.
What could be the problem?
import Foundation
import WeatherKit
class WeatherKitManager: ObservableObject {
@Published var weather: Weather?
@Published var isFetchingWeather = false
func getWeather(latitude: Double, longitude: Double) async {
do {
let receivedWeather = try await WeatherService.shared.weather(for: .init(latitude: latitude, longitude: longitude))
DispatchQueue.main.async {
self.weather = receivedWeather
}
} catch {
fatalError("\(error)")
}
}
var symbol: String {
weather?.currentWeather.symbolName ?? "xmark.app"
}
var temp: String {
if let temp = weather?.currentWeather.temperature.converted(to: .celsius) {
let formattedTemp = String(format: "%.1f", temp.value)
return "\(formattedTemp)°C"
} else {
return "Yükleniyor..."
}
}
}
Errors here
Ceyehat/WeatherKitManager.swift:22: Fatal error: Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2 "(null)"
Failed to generate jwt token for: com.apple.weatherkit.authservice with error: Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2 "(null)"
Encountered an error when fetching weather data subset; location=<+37.78583400,-122.40641700> +/- 0.00m (speed -1.00 mps / course -1.00) @ 06/06/2023, 5:32:55 PM GMT+03:00, error=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors 2 Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2 "(null)"
Post not yet marked as solved
Am just learning to use mapkit.
Am attempting to draw 1 mile squares over a given region which can then me viewed on ipad or iphone.
Ideally apple watch would provide haptic when such lines are crossed by the user.
Where might I start?
Post not yet marked as solved
The new Map builder SwiftUI is awesome. Does it support cluster annotations? I have opened FB12244017. Thank you very much!
Post not yet marked as solved
Like the screenshot of the apple developer app:
How do I in my app add a serch box at the top of the sidebar option in SwiftUI?
Also how do I add an account link at the bottom of the sidbar?
I'm working on a SwiftUI project where I have one rectangle that I want to be draggable within an active area. However, I'm facing an issue where the rectangle can go outside the active area during the drag gesture. I want to constrain the position of the rectangle so that it stays within the active area during the drag gesture. How can I achieve this? Any insights or suggestions would be greatly appreciated. Thank you in advance!
Here's a simplified version of my code:
struct ContentView: View {
@State var position = CGSize.zero
@State var lastPosition = CGSize.zero
var body: some View {
ZStack {
Rectangle()
.fill(Color(red: 0.5450980392156862, green: 0.5450980392156862, blue: 0.5450980392156862))
.aspectRatio(0.75, contentMode: .fit)
.frame(height: 550)
.cornerRadius(30)
.offset(x: position.width, y: position.height)
.animation(.spring(response: 0.4, dampingFraction: 0.4, blendDuration: 0.4))
.gesture(
DragGesture()
.onChanged({ value in
position = CGSize(width: lastPosition.width + value.translation.width, height: lastPosition.height + value.translation.height)
})
.onEnded({ value in
lastPosition = position
})
)
.padding()
}
}
}
Post not yet marked as solved
I have an app that displays a large number of physically marked walking routes in The Netherlands. Loads of fun. For my next release I'm planning to add filters to the map, to make it easier to find the best route.
I have build a solution for that, but I'm sure there's a more efficient or clean way to do this. Thus I turn to you, the community, for a sanity check.
My setup data structure wise (unchangeable) - simplified to relevant-only for readability:
struct Location: Codable, Identifiable, Hashable, Equatable {
let id: Int
let longitude, latitude: Double
let routes: [Route]
}
struct Route: Codable, Identifiable {
let id : Int
let marking: String
let distance: Double
}
I have an array of Location objects, which in turn include an array of Route objects (max 5).
Each route has a distance (length of the walk) attribute. I want to filter for a specific distance. Routes are ordered by length inside a Location. So the shortest walk at a specific location is locations.place[xyz].route[0]
I have a filter button setup that outputs a minDistance and maxDistance : Double that I feed into the filter fund.
My current filter function solution checks index 0:
return locations.places.filter { location in
(minDistance..<maxDistance).contains(location.routes[0].distance)
}
This returns an array of locations where route[0] (the shortest walk at the location) matches the user's preferred walk length.
This means that I miss a fair amount of positive results. I feel like something like this should be possible, to check all routes at a location:
return locations.places.filter { location in
(minDistance..<maxDistance).contains(location.routes[*].distance)
}
Unfortunately this doesn't work. Neither does [0...5] or similar thoughts.
As I'm quite new at developing, and I only have short bursts of time to work on this app, I feel like I might be missing something very obvious here.
Is there a way to change the .contains(location.routes[something-goes-here].distance) check to test all routes and not just index 0?
Post not yet marked as solved
I'm working on a workout app which has an array within an array and takes user input to populate each array.
In the first array, I can add an item to plans using the addPlan function. However, I cannot seem to figure out how to add items to the next level in the addExercise function.
final class ViewModel: ObservableObject {
@Published var plans: [Plan] = []
func addPlan(_ item: String) {
let plan = Plan(name: item, exercise: [])
plans.insert(plan, at: 0)
}
func addExercise() {
}
}
Essentially, Plan holds an array of Exercise. Here is the model for Plan
struct Plan: Identifiable {
let id = UUID()
let name: String
var exercise: [Exercise]
static let samplePlans = Plan(name: "Chest", exercise: [Exercise(name: "Bench"), Exercise(name: "Incline Bench")])
}
These two functions should behave the same but just appending the items into different arrays.
The end result would be:
Plan 1: [Exercise1, Exercise2, Exercise3]
Plan 2: [Exercise4, Exercise5, Exercise6] etc.
Project files: LINK
Post not yet marked as solved
Can someone please help me understand PassthroughSubject and CurrentValueSubject? What I understand so far is that they are subjects where subscribers can listen to changes made to these subjects, but I'm really straggling to understand the following.
I'm I correct by saying that PassthroughSubject or CurrentValueSubject could replace delegation and asynchronous function calls?
Is it possible to delare a subject in Class A and subscribe to listen to those subject changes in Class B and in some other classes or are listeners meant to only be used direclty in SwiftUI structs?
Thanks
Post not yet marked as solved
I am designing a unique calculator interface inspired by the stage manager, desktop experience, and Group FaceTime concepts. The interface consists of three draggable widgets that serve different purposes. The first widgets acts as the display for the calculator, providing a blank canvas for the calculations. The second widget contains scientific buttons, allowing users to perform advanced mathematical operations. The third widget consists of basic calculator buttons for standard arithmetic functions. By combining these elements, the calculator aims to provide a versatile and intuitive user experience.
How can I implement a draggable interface for a calculator in SwiftUI that matches the image of my design below, where the user can interact with three separate rectangles representing the calculator display, working scientific buttons, and working basic calculator buttons?
The design I'm trying to follow and the individual widgets are shown in this image:
Here's a minimal SwiftUI code example that represents my attempt at the described draggable calculator interface:
struct ContentView: View {
@State private var displayPosition: CGSize = .zero
@State private var scientificButtonsPosition: CGSize = .zero
@State private var basicButtonsPosition: CGSize = .zero
var body: some View {
ZStack {
Color.gray.opacity(0.2)
.ignoresSafeArea()
DraggableRectangle(position: $displayPosition, color: .white) {
// Calculator Display
// Customize the view as per your requirements
Text("Display")
.font(.title)
}
DraggableRectangle(position: $scientificButtonsPosition, color: .blue) {
// Scientific Buttons
// Customize the view as per your requirements
Text("Scientific Buttons")
.font(.headline)
.foregroundColor(.white)
}
DraggableRectangle(position: $basicButtonsPosition, color: .green) {
// Basic Calculator Buttons
// Customize the view as per your requirements
Text("Basic Buttons")
.font(.headline)
.foregroundColor(.white)
}
}
.frame(minWidth: 800, minHeight: 600)
}
}
struct DraggableRectangle<Content: View>: View {
@Binding var position: CGSize
let color: Color
let content: () -> Content
var body: some View {
content()
.frame(width: 400, height: 300)
.background(color)
.cornerRadius(8)
.offset(position)
.gesture(
DragGesture()
.onChanged { value in
position = value.translation
}
.onEnded { _ in
position = .zero
}
)
}
}
Post not yet marked as solved
Is there an easy way to convert a storyboard made for iOS to one made for a Mac? Failing that, is there an easy way to convert a storyboard to SwiftUI?
Post not yet marked as solved
So I'm trying to use MapKit in a SwiftUI project targeting iOS/iPadOS. MapKit is obviously pretty limited in SwiftUI, but I've been getting warnings trying to set up basic annotations for the user to interact with.
When I use a basic MapMarker everything is fine (although it's hard to do anything with it), but whenever I do anything with MapAnnotation, I get this warning in Xcode (14.0.1) whenever I move the map around:
[SwiftUI] Publishing changes from within view updates is not allowed, this will cause undefined behavior.
I'm no SwiftUI expert, and I get how to fix this issue when binding in something like a sheet, but I don't see how what I'm doing with MapAnnotation should be causing this.
It looks like a bug to me, possibly complaining about the $region binding, but maybe I'm wrong? Am I doing something wrong or is this a bug?
Below is some sample code that reproduces this easily for me (just launch an app with the below code and then drag the map around to see the constant warnings in Xcode). It's mostly an example from here: https://www.hackingwithswift.com/books/ios-swiftui/integrating-mapkit-with-swiftui
import SwiftUI
import MapKit
struct Location: Identifiable {
let id = UUID()
let name: String
let coordinate: CLLocationCoordinate2D
}
struct ContentView: View {
@State private var region = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: 51.5, longitude: -0.12), span: MKCoordinateSpan(latitudeDelta: 0.2, longitudeDelta: 0.2))
let locations = [
Location(name: "Buckingham Palace", coordinate: CLLocationCoordinate2D(latitude: 51.501, longitude: -0.141)),
Location(name: "Tower of London", coordinate: CLLocationCoordinate2D(latitude: 51.508, longitude: -0.076))
]
var body: some View {
Map(coordinateRegion: $region, annotationItems: locations) { location in
MapAnnotation(coordinate: location.coordinate) {
Circle()
.stroke(.red, lineWidth: 3)
.frame(width: 44, height: 44)
}
}
.navigationTitle("Map")
.edgesIgnoringSafeArea(.all)
}
}
Post not yet marked as solved
My app is crashing on iOS 15 when entering a screen and I have no idea from the logs what is going on. It all looks like internal SwiftUI stack trace. Would appreciate any help in the right direction:
0 AttributeGraph 0x422c AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, unsigned char&, long) + 344
1 AttributeGraph 0x1e54 AGGraphGetValue + 240
2 SwiftUI 0x204dd0 HitTestBindingFilter.updateValue() + 164
3 SwiftUI 0x25c62c partial apply for specialized implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 24
4 AttributeGraph 0x3b18 AG::Graph::UpdateStack::update() + 524
5 AttributeGraph 0x3508 AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) + 396
6 AttributeGraph 0x1c8c AG::Graph::value_ref(AG::AttributeID, AGSwiftMetadata const*, unsigned char&) + 192
7 AttributeGraph 0x1ea0 AGGraphGetValue + 316
8 SwiftUI 0xe2bc ViewGraph.responderNode.getter + 120
9 SwiftUI 0xe154 closure #1 in ViewRendererHost.responderNode.getter + 28
10 SwiftUI 0x15618 closure #1 in ViewRendererHost.updateViewGraph<A>(body:) + 108
11 SwiftUI 0xe0f8 ViewRendererHost.updateViewGraph<A>(body:) + 96
12 SwiftUI 0x151620 ViewRendererHost.responderNode.getter + 132
13 SwiftUI 0x1de298 FocusBridge.hostDidBecomeFirstResponder(in:) + 64
14 SwiftUI 0x2160cc FocusBridge.hostingControllerDidAppear() + 120
15 SwiftUI 0x33240 _UIHostingView.viewControllerDidAppear(transitionCoordinator:animated:) + 32
16 SwiftUI 0x39e70 UIHostingController.viewDidAppear(_:) + 100
17 SwiftUI 0x18550c @objc UIHostingController.viewDidAppear(_:) + 28
18 UIKitCore 0x1ab374 -[UIViewController _setViewAppearState:isAnimating:] + 892
19 UIKitCore 0x2972d8 -[UIViewController __viewDidAppear:] + 172
20 UIKitCore 0x6567d8 -[UINavigationController viewDidAppear:] + 192
21 UIKitCore 0x1ab374 -[UIViewController _setViewAppearState:isAnimating:] + 892
22 UIKitCore 0x99ee0c __52-[UIViewController _setViewAppearState:isAnimating:]_block_invoke_2 + 196
23 UIKitCore 0x2cc534 __52-[UIViewController _setViewAppearState:isAnimating:]_block_invoke + 228
24 CoreFoundation 0xd564 __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ + 24
25 CoreFoundation 0x947f4 -[__NSSingleObjectArrayI enumerateObjectsWithOptions:usingBlock:] + 92
26 UIKitCore 0x1ab53c -[UIViewController _setViewAppearState:isAnimating:] + 1348
27 UIKitCore 0x2972d8 -[UIViewController __viewDidAppear:] + 172
28 UIKitCore 0x219a68 -[UIViewController _endAppearanceTransition:] + 252
29 UIKitCore 0x3b20e0 -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:] + 1500
30 UIKit 0x6e06c -[UINavigationControllerAccessibility navigationTransitionView:didEndTransition:fromView:toView:] + 112
31 UIKitCore 0x46b548 __49-[UINavigationController _startCustomTransition:]_block_invoke + 608
32 UIKitCore 0x23f458 -[_UIViewControllerTransitionContext completeTransition:] + 124
33 UIKitCore 0x9be66c __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke.162 + 836
34 UIKitCore 0x12aa4dc __UIVIEW_IS_EXECUTING_ANIMATION_COMPLETION_BLOCK__ + 36
35 UIKitCore 0x2c2fac -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 728
36 UIKitCore 0x18ed0c -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 248
37 UIKitCore 0x1a350c -[UIViewAnimationState animationDidStop:finished:] + 244
38 UIKit 0xd305c -[UIViewAnimationStateAccessibility animationDidStop:finished:] + 212
39 XCTAutomationSupport 0x17ab8 XCTAnimationDidStop + 24
40 UIKitCore 0x1a3674 -[UIViewAnimationState animationDidStop:finished:] + 604
41 UIKit 0xd305c -[UIViewAnimationStateAccessibility animationDidStop:finished:] + 212
42 XCTAutomationSupport 0x17ab8 XCTAnimationDidStop + 24
43 QuartzCore 0xcbe50 CA::Layer::run_animation_callbacks(void*) + 280
44 libdispatch.dylib 0x3a30 _dispatch_client_callout + 20
45 libdispatch.dylib 0x11f48 _dispatch_main_queue_drain + 928
46 libdispatch.dylib 0x11b98 _dispatch_main_queue_callback_4CF + 44
47 CoreFoundation 0x51800 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
48 CoreFoundation 0xb704 __CFRunLoopRun + 2532
49 CoreFoundation 0x1ebc8 CFRunLoopRunSpecific + 600
50 GraphicsServices 0x1374 GSEventRunModal + 164
51 UIKitCore 0x514b58 -[UIApplication _run] + 1100
52 UIKitCore 0x296098 UIApplicationMain + 364
53 SwiftUI 0x23ff24 closure #1 in KitRendererCommon(_:) + 164
54 SwiftUI 0x16de08 runApp<A>(_:) + 252
55 SwiftUI 0x14f0f4 static App.main() + 128
56 BlueVine_Mobile 0x471284 static BlueVineMobileApp.$main() + 14 (BlueVine_MobileApp.swift:14)
57 BlueVine_Mobile 0x473ea8 main + 12 (BlueVine_MobileApp.swift:12)
58 ??? 0x101f99da4 (Missing)
I'm trying to make a custom TextField which eventually show errors when loosing focus
in a normal form, foreach TextField, I write:
TextField(label, text: $text)
.focused($checkoutInFocus, equals: <some Value>)
Text(textError)
.foregroundColor(.red)
.frame(height: textError == "" ? 0 : 20)
(I want to precise it's not all: I have many modifiers for the TextField and it becomes very difficult to read when there are many TextFields)
So I thought it would be a good idea to make a special view for each Textfield:
struct TextFieldWithError: View {
var label: String
@Binding var text: String
@Binding var textError: String
@FocusState.Binding var isFocused: Bool
init(label: String, text: Binding<String>, textError: Binding<String>, isFocused: FocusState<Bool>.Binding) {
self.label = label
self._text = text
self._textError = textError
self._isFocused = isFocused
}
var body: some View {
TextField(label, text: $text)
.modifier(TextFieldStyle())
.focused($isFocused)
Text(textError)
.foregroundColor(.red)
.frame(height: textError == "" ? 0 : 20)
}
}
My problem is that I don't find the way to act on the focusState.
In the mainView I write:
TextFieldWithError(label: "Email", text: $email, textError: $emailError, isFocused: checkoutInFocus == .<some Value>)
in place of the modifier
.focused($checkoutInFocus, equals: .email)
but the syntax is obviously not good: I get the error:
Cannot convert value of type 'Bool' to expected argument type 'FocusState.Binding'
Do you think there is a way?
Hi forum members,
I am a beginner Swift programmer who is struggling to create my first prototype of SNS-type app. I am building an account creation page currently and I'm stacked at the stage to implement confirmation page for users to check if the information they input on the previous page is correct. I have now wrote the code below but it seems the code failed to display the user input on confirmation page. It seems the code stacked at the stage to pass information to Confirmation page.
import SwiftUI
struct AccountRegistrationView: View {
@State private var userName = ""
@State private var email = ""
@State private var pass = ""
var body: some View {
NavigationStack {
VStack() {
Text("Welcome to XXXXXXXXX!")
.font(.largeTitle)
.fontWeight(.bold)
.foregroundColor(.mint)
.padding(10.0)
Text("Enter your user name, email address and password.")
.font(.body)
.multilineTextAlignment(.center)
.frame(width: 320.0, height: 50.0)
}
VStack {
TextField("User name", text: $userName)
.multilineTextAlignment(.center)
.padding(.all, 20.0)
.textFieldStyle(RoundedBorderTextFieldStyle())
TextField("Email address", text: $email)
.multilineTextAlignment(.center)
.padding(.all, 20.0)
.textFieldStyle(RoundedBorderTextFieldStyle())
TextField("Password", text: $pass)
.multilineTextAlignment(.center)
.padding(.all, 20.0)
.textFieldStyle(RoundedBorderTextFieldStyle())
}
NavigationLink {
ConfirmationView()
} label: {
Label("Next", systemImage: "arrowshape.forward.fill")
.font(.body)
}
}
}
struct ConfirmationView: View {
let userInfo = AccountRegistrationView()
var body: some View {
Text("User name: \(userInfo.userName)")
.multilineTextAlignment(.center)
.padding(.all, 20.0)
Text("Email address: \(userInfo.email)")
.multilineTextAlignment(.center)
.padding(.all, 20.0)
Text("Password: \(userInfo.pass)")
.multilineTextAlignment(.center)
.padding(.all, 20.0)
}
}
struct AccountRegistrationView_Previews: PreviewProvider {
static var previews: some View {
AccountRegistrationView()
}
}
}
It would be much appreciated if you can point out which part of the code is causing the error and how to fix it.
Thank you so much for your support in advance!
Post not yet marked as solved
I have an existing ScrollView view with a Picker. Upon selection of a picker value, and user pressing the details button, I want to append a view to the bottom of the existing view. I call detailsView. But it does not seem to work.
@Environment(\.managedObjectContext) private var viewContext
@Environment(\.dismiss) var dismiss
@Environment(\.presentationMode) var presentationMode
@Binding var chosenProvider: Provider?
@State var selectedLocation: Location?
@State private var vendorNames: [String] = []
@State private var selectedVendor:String? = nil
@State private var showingSheet = false
@State var state: String?
@State var zip: String?
var body: some View {
ScrollView {
VStack {
HStack {
Text("Select Vendor")
Picker("Provider", selection: $selectedVendor , content: {
ForEach(vendorNames,id: \.self, content: { name in
Text(name)
})
})
.pickerStyle(MenuPickerStyle())
.onTapGesture {
self.getVendorNames() { providers, status in
if (status) {
vendorNames = providers
}
}
}
}
.onChange(of: selectedVendor, perform: { newValue in
selectedVendor = newValue
})
.tint(.orange)
Button {
DetailsView()
} label: {
Label("Details", systemImage: "list.bullet.rectangle")
.foregroundColor(.blue)
}
Spacer()
}
}
.onAppear{
self.getVendorNames() { providers, status in
if (status) {
vendorNames = providers
}
}
}
.navigationTitle("Add Vendor")
.toolbar {
// Back button
ToolbarItem(placement: .navigationBarLeading) {
Button(action: { presentationMode.wrappedValue.dismiss() }, label: {
HStack(spacing: 2) {
Image(systemName: "chevron.backward")
.foregroundColor(.black)
Button("Back", action: {
self.presentationMode.wrappedValue.dismiss()
} )
.foregroundColor(.black)
}
})
}
}
.navigationViewStyle(StackNavigationViewStyle())
.navigationBarBackButtonHidden(true)
}
struct DetailsView: View {
var body: some View {
VStack {
Text("Some Details")
}
}
}
func getVendorNames (completionHandler: @escaping ([String], Bool) -> Void ) {
var names = ["Acme", "Abc"]
completionHandler(names, true)
}
}
Post not yet marked as solved
Although possibly frowned upon, collections of data are commonly input into spreadsheets and this remains, and probably alway will, the main means of data collection and storage rather than databases for scientists everywhere.
It is necessary, therefore, to ascertain ways in which data acquired and stored through these means can be successfully extracted and put in a format which can be displayed using modern means of technology.
Mobile phones and Tablets are commonly and increasingly being used to access and display data. However, the means by which these data are transferred are through Databases which may not be appealing to some who use spreadsheets to acquire and store their data.
The important question is: Is there some straightforward means by which spreadsheet data (perhaps comma separated value (csv) files) can be read by the latest SwiftUI and Xcode 16 formats?
This would be an enormous advantage to those who update files of data regularly.
If this is so, then I will gladly spend the time to learn the nomenclature and structural language necessary to implement a simple app to display some rather complex data. I have scanned the forum for satisfactory suggestions to this problem but it seems that the software has moved on but the problem remains.
Kind Regards,
Post not yet marked as solved
Greetings,
We have observed an alarming number of crashes exceeding 1 million across various operating systems and devices. These crashes consistently point to a PAC failure in the specialized PreferenceNode.find<A>(key:) + 16 (PreferenceList.swift:146) function.
The stack trace is exclusively a system-level stack, lacking any application-level stacks for us to go on. This makes it rather impossible for us to debug within our own application, since we do not have system-level context.
Our analysis suggests that this issue may stem from either a compiler bug or an incorrectly implemented virtual-function in the AttributeGraph framework, resulting in a pointer-authentication failure in the SwiftUI framework.
Lastly, if it helps, based on our own logs, we have determined that the problem primarily occurs when users return from being in the background for more than 60 minutes. However, despite numerous attempts, we have been unable to reproduce the issue ourselves.
We kindly request your guidance on the most effective approach to address this matter confidently.
display simple view with two text fields inside a vStack/HStack combination. It leaves huge gap at the top as shown on the attached image. I tried vStack, it has .leading and .trailing which justifies left or right. How can set specific spacing at the top? code:
@Environment(\.managedObjectContext) private var viewContext
@Environment(\.dismiss) var dismiss
@Environment(\.presentationMode) var presentationMode
@Binding var chosenPlan: ProviderApiCaller.ProviderData
@State var state: String?
@State var zip: String?
func onAdd(plan: ProviderApiCaller.ProviderData ) {
}
var body: some View {
NavigationView {
VStack {
HStack {
Text(chosenPlan.name!)
}
HStack {
Text(chosenPlan.plans.first!.planUrl)
}
}
}
.navigationTitle("Plan Details")
.toolbar {
// Back button
ToolbarItem(placement: .navigationBarLeading) {
Button(action: { presentationMode.wrappedValue.dismiss() }, label: {
HStack(spacing: 2) {
Image(systemName: "chevron.backward")
.foregroundColor(.black)
Button("Back", action: {
self.presentationMode.wrappedValue.dismiss()
} )
.foregroundColor(.black)
}
})
}
ToolbarItem(placement: .confirmationAction) {
// Button("Save", action: { Task { try? await rI?(nameInput, phoneInput) } })
Button("Save", action: { onAdd(plan: chosenPlan)
} )
.foregroundColor(.blue)
}
}
.navigationViewStyle(StackNavigationViewStyle())
.navigationBarBackButtonHidden(true)
}
