Posts

Post not yet marked as solved
2 Replies
59 Views
Is there a system deep link URI to the built in files app? I would like to direct users to my apps location in the files app. For example files://myApp The only exposed deep links for system I can find are the ones for mail, sms, FaceTime etc. Thank you (tag used for post was because I couldn’t find a deep link tag)
Posted
by RyanTCB.
Last updated
.
Post not yet marked as solved
1 Replies
123 Views
Users have reported unusually high data usage with my app. So to investigate I have profiled in instruments. My app as expected in using minimal data. However in instruments I see an "Unknown" process. Which sends around 1mb of data every 2 seconds. Can anyone explain what unknown process is? Sorry my question is vague but I'm at the beginning of understanding the instruments outputs so your help is so very much appreciated.
Posted
by RyanTCB.
Last updated
.
Post not yet marked as solved
1 Replies
417 Views
TLDR; Can I have a widget without a Timeline? My previous watch app had a complication. Simply so it can be added to the watch face for a quick launch of the app. However now seeing that method is deprecated in favour of widgets. Can I add a widget without the need for all the Timeline as all I want is a button on the watch face to launch into my app. No data is updated over time so no need for all the extra timeline code.
Posted
by RyanTCB.
Last updated
.
Post not yet marked as solved
0 Replies
241 Views
if I get the string contents of a PDF and print to the console in Xcode . when run on simulator it’s fine but on device some words are missing. same PDF, same code. only difference is simulator and physical device. its only a word or two missing from the page. anyone have any experience or suggestions with PDFKit to explain why a string would be missing the odd word ?
Posted
by RyanTCB.
Last updated
.
Post not yet marked as solved
0 Replies
240 Views
Im trying to duplicate the display of the built in Files app for documents in my app. How do I convert a page in a PDFDocument to an Image to display as an icon like seen here (from Files App) with SwiftUI. SOLVED: Image(uiImage: (document.page(at: 0)?.thumbnail(of: CGSize(width: 100, height: 100), for: .cropBox))!)
Posted
by RyanTCB.
Last updated
.
Post not yet marked as solved
0 Replies
334 Views
@Model class modelData { var property1 : String = "" init(property1: string){ ... } } for item in arrayOfManyStrings { let instanceOfModelData = modelData(property1: item) } Trying to create multiple instances of my modelData. I expect the loop to run and create instanceOfModelData 30k times. However it is far too slow. 30-90 seconds depending on device. If I remove the @Model macro, the same loop take < 5 seconds. I obviously need the @Model for swiftData. How to speed up creating instances of instanceOfModelData when using @Model
Posted
by RyanTCB.
Last updated
.
Post not yet marked as solved
2 Replies
363 Views
How to show the keyboard for textfield on ToolbarItem(placement: .keyboard)? I have a button and it's action I want is to show the keyboard. On top of which is ToolbarItem(placement: .keyboard) { HStack{ Button(...) TextField("", text: $bindingText) .textFieldStyle(RoundedBorderTextFieldStyle()) .keyboardType(.numberPad) .multilineTextAlignment(.trailing) } } I know keyboard shows with a textfield focused. How though to show the keyboard for ToolbarItem(placement: .keyboard) Textfield if can't show it without showing the keyboard?
Posted
by RyanTCB.
Last updated
.
Post not yet marked as solved
2 Replies
658 Views
Is SwiftData not designed for large datasets? How to create many instances of my Data Model? I have a loop where I iterate over a CSV file of 30k+ lines. Totalling around 230k elements. I intend to save this data into SwiftData. However it takes around 90 seconds. In previous versions of my app I was using coreData. Then it took just 3 seconds. So after much investigation I have concluded the delay comes from creating instances of the Data Model. To Test this I have : Removed any saves into SwiftData. So only creation of the Model Object occurs. Created an exact copy of the SwiftData Model class but admitted the @Model macro set isAutosaveEnabled to false When I run my loop with the copy class it takes 3 seconds. So It must be creating the SwiftData model instances that causes the *30 delay. The code using swiftData @Model. This loop takes 90+ seconds to complete class TimetableData { var arrivalTime : Int = 0 var departureTime: Int = 0 var departureRoute : Int = 0 var directionOfTravel : Int = 0 var dutyNumber : Int = 0 var facilityIdentifier : String = "" var locationType : String = "" var mode : String = "" var nonStopStatus : Int = 0 var recordIdentifier : String = "" var timetableIdentifier : Int = 0 var trainNumber : String = "" var tripNumber : Int = 0 var tripStartSite : String = "" var uniqueLocationCode : String = "" init(arrivalTime: Int = 0, departureTime: Int = 0, departureRoute: Int = 0, directionOfTravel: Int = 0, dutyNumber: Int = 0, facilityIdentifier: String = "", locationType: String = "", mode: String = "", nonStopStatus: Int = 0, recordIdentifier: String = "", timetableIdentifier: Int = 0, trainNumber: String = "", tripNumber: Int = 0, tripStartSite: String = "", uniqueLocationCode: String = "") { self.name = name self.arrivalTime = arrivalTime self.departureTime = departureTime self.departureRoute = departureRoute self.directionOfTravel = directionOfTravel self.dutyNumber = dutyNumber self.facilityIdentifier = facilityIdentifier self.locationType = locationType self.mode = mode self.nonStopStatus = nonStopStatus self.recordIdentifier = recordIdentifier self.timetableIdentifier = timetableIdentifier self.trainNumber = trainNumber self.tripNumber = tripNumber self.tripStartSite = tripStartSite self.uniqueLocationCode = uniqueLocationCode } } for line in CSVFile { var columnValue = line.components(separatedBy: ",") let timeTableDataEntry = TimetableData ( arrivalTime: Int(columnValue[0])!, departureTime: Int(columnValue[1])!, departureRoute: Int(columnValue[2])!, directionOfTravel: Int(columnValue[3])!, dutyNumber: Int(columnValue[4])!, facilityIdentifier: columnValue[5], locationType: columnValue[6], mode: columnValue[7], nonStopStatus: Int(columnValue[8])!, recordIdentifier: columnValue[9], timetableIdentifier: Int(columnValue[10])!, trainNumber: columnValue[11], tripNumber: Int(columnValue[12])!, tripStartSite: columnValue[13], uniqueLocationCode:columnValue[14] ) } Then The exact same code but omitting the @Model takes around just 3 second. class TimetableDataForTesting { var arrivalTime : Int = 0 var departureTime: Int = 0 var departureRoute : Int = 0 var directionOfTravel : Int = 0 var dutyNumber : Int = 0 var facilityIdentifier : String = "" var locationType : String = "" var mode : String = "" var nonStopStatus : Int = 0 var recordIdentifier : String = "" var timetableIdentifier : Int = 0 var trainNumber : String = "" var tripNumber : Int = 0 var tripStartSite : String = "" var uniqueLocationCode : String = "" init(arrivalTime: Int = 0, departureTime: Int = 0, departureRoute: Int = 0, directionOfTravel: Int = 0, dutyNumber: Int = 0, facilityIdentifier: String = "", locationType: String = "", mode: String = "", nonStopStatus: Int = 0, recordIdentifier: String = "", timetableIdentifier: Int = 0, trainNumber: String = "", tripNumber: Int = 0, tripStartSite: String = "", uniqueLocationCode: String = "") { self.name = name self.arrivalTime = arrivalTime self.departureTime = departureTime self.departureRoute = departureRoute self.directionOfTravel = directionOfTravel self.dutyNumber = dutyNumber self.facilityIdentifier = facilityIdentifier self.locationType = locationType self.mode = mode self.nonStopStatus = nonStopStatus self.recordIdentifier = recordIdentifier self.timetableIdentifier = timetableIdentifier self.trainNumber = trainNumber self.tripNumber = tripNumber self.tripStartSite = tripStartSite self.uniqueLocationCode = uniqueLocationCode } } for line in CSVFile { var columnValue = line.components(separatedBy: ",") let timeTableDataEntry = TimetableDataForTesting ( arrivalTime: Int(columnValue[0])!, departureTime: Int(columnValue[1])!, departureRoute: Int(columnValue[2])!, directionOfTravel: Int(columnValue[3])!, dutyNumber: Int(columnValue[4])!, facilityIdentifier: columnValue[5], locationType: columnValue[6], mode: columnValue[7], nonStopStatus: Int(columnValue[8])!, recordIdentifier: columnValue[9], timetableIdentifier: Int(columnValue[10])!, trainNumber: columnValue[11], tripNumber: Int(columnValue[12])!, tripStartSite: columnValue[13], uniqueLocationCode:columnValue[14] ) }
Posted
by RyanTCB.
Last updated
.
Post not yet marked as solved
0 Replies
528 Views
There's another thread on here with similar Q but seems to have no resolution. So starting my own. The basics Xcode 15.3.0 beta 3 iOS 17.4 The WatchOS 10.4 I have an iPhone app with a companion watch app. In Xcode if I set the scheme to my iOS app it installs on my phone but the companion watch app does not auto install on my watch. Automatic App Install is turned on in Watch app on iPhone. To run the app on watchOS I have to run it directly from the watch scheme on Xcode. If I delete the app from the watch then go into the iOS watch app on the iOS device to install on my watch I receive an error "This app could not be installed at this time" Is there a known cause solution?
Posted
by RyanTCB.
Last updated
.
Post not yet marked as solved
1 Replies
775 Views
27" intel Mac Ventura 13.6.4 Developer site says MacOS 13.5 or later required for Xcode 15.3 Beta. Download, Expand .xip, Attempt to open application "You can’t use this version of the application “Xcode-beta” with this version of macOS. You have macOS 13.6.4. The application requires macOS 14.0 or later." Developer site clearly says 13.5 or Later which 13.6.4 is. So why on wasting my time downloading and unarchiving dos it now claim to need 14.0??
Posted
by RyanTCB.
Last updated
.
Post not yet marked as solved
1 Replies
455 Views
Submitted a TSI 4 days ago. Heard nothing back. Status Used. Surely a TSI is a fulfilled request and not just ignored? Also the forum tags don't have TSI so not sure where this post will end up
Posted
by RyanTCB.
Last updated
.
Post marked as solved
1 Replies
468 Views
2 versions 1 works 1 doesn't. UIViewRepresentable to show a PDF @AppStorage(DefaultsKey.userActiveBook.rawValue) var activeBook : URL = Bundle.main.url(forResource: "BookPlaceHolder", withExtension: "pdf")! func makeUIView(context: Context) -&gt; PDFView { do { let pdfData = try Data(contentsOf: activeBook) pdfView.document = PDFDocument(data: pdfData) //&lt;---- is nil ... } catch let Error { print(Error) } } fails with Error Domain=NSCocoaErrorDomain Code=260 "The file “BookPlaceHolder.pdf” couldn’t be opened because there is no such file." func makeUIView(context: Context) -&gt; PDFView { do { let pdfData = try Data(contentsOf: Bundle.main.url(forResource: "BookPlaceHolder", withExtension: "pdf")!) pdfView.document = PDFDocument(data: pdfData) ... } catch let Error { print(Error) } } Works perfectly. What is it with using @AppStorage to access the exact same URL causing the discrepancies ?
Posted
by RyanTCB.
Last updated
.