Post

Replies

Boosts

Views

Activity

chartXAxis AxisMark consisting of Month:Year
I have a Chart displaying Counts per Date over 2-3 years. I'd like to have the XAxis mark consist of MM-yy or even MM/nyy. Is this possible? OK, just saw AxisValueLabel(format: .dateTime.month().year()) which gives e.g. Mar 2024. This is good. Better might be Mar 24 (maybe a Y3K problem ;-) or even better Mar. OR Mar 24. 2024 Or best increment the year when it changes. Are any of these alternate formats possible? Thanks, David PS, my current .chartXAxis code .chartXAxis { AxisMarks(values: .stride(by: .month, count: 3)) { value in if value.as(Date.self) != nil { AxisValueLabel(format: .dateTime.month().year()) AxisGridLine() AxisTick() } } }
1
0
80
Jun ’25
Filtered dataFrame displays original dataFrame values
I'm importing a csv file of 299 rows and creating a subset by filtering on one column value (24 rows). I want to Chart just the filtered values. However, when I print one column I get values from the original dataFrame. Any suggestions? Thanks, David The code: import SwiftUI import Charts import TabularData struct DataPoint: Identifiable { var id = UUID() // This makes it conform to Identifiable var date: Date var value: Double } struct ContentView: View { @State private var dataPoints: [DataPoint] = [] var body: some View { Text("Hello") Chart { ForEach(dataPoints) { dataPoint in PointMark( x: .value("Date", dataPoint.date), y: .value("Value", dataPoint.value) ) } } .frame(height: 300) .padding() .onAppear(perform: loadData) } func loadData() { print("In Loading Data") // Load the CSV file if let url = Bundle.main.url(forResource: "observations", withExtension: "csv") { do { let options = CSVReadingOptions(hasHeaderRow: true, delimiter: ",") var data0 = try DataFrame(contentsOfCSVFile: url, options: options) let formattingOptions = FormattingOptions( maximumLineWidth: 200, maximumCellWidth: 15, maximumRowCount: 30 ) // print(data0.description(options: formattingOptions)) print("Number of Columns: \(data0.columns.count)") let columnsSet = ["plant_id", "date", "plot", "plantNumber", "plantCount"] data0 = try DataFrame(contentsOfCSVFile:url, columns: columnsSet, options: options) print("Number of Columns (after columnsSet): \(data0.columns.count)") print("Printing data0") print(data0.description(options: formattingOptions)) let data = data0.filter { $0["plant_id"] as? Int == 15 } print("Printing data") print(data.description(options: formattingOptions)) print(" Number of Rows \(data.rows.count)") for i in 0 ... data.rows.count { // print("\(i): \(data["plantCount"][i]!)") if let plantCount = data["plantCount"][i] as? Int { print("\(i): \(plantCount)") } else { print("\(i): Value not found or invalid type") } } // // var newDataPoints: [DataPoint] = [] // Here I plan to add the filtered data to DataPoint // DispatchQueue.main.async { dataPoints = newDataPoints } } catch { print("Error reading CSV file: \(error)") } } else { print("Didn't load csv file") } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } } Here is the new dataFrame and print output Printing data ┏━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━┓ ┃ ┃ plant_id ┃ date ┃ plot ┃ plantNumber ┃ plantCount ┃ ┃ ┃ <Int> ┃ <String> ┃ <Int> ┃ <Int> ┃ <Int> ┃ ┡━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━┩ │ 0 │ 15 │ 2023-09-07 │ 1 │ 5 │ 5 │ │ 32 │ 15 │ 2023-09-07 │ 2 │ 10 │ 10 │ │ 38 │ 15 │ 2023-09-07 │ 2 │ 20 │ 20 │ │ 66 │ 15 │ 2023-09-07 │ 4 │ 25 │ 25 │ │ 77 │ 15 │ 2023-09-07 │ 5 │ 5 │ 5 │ │ 99 │ 15 │ 2023-09-14 │ 7 │ 45 │ 45 │ │ 142 │ 15 │ 2024-05-30 │ 1 │ 20 │ 20 │ │ 162 │ 15 │ 2024-05-30 │ 4 │ 5 │ 5 │ │ 169 │ 15 │ 2024-05-30 │ 5 │ 10 │ 10 │ │ 175 │ 15 │ 2024-05-30 │ 7 │ 10 │ 10 │ │ 188 │ 15 │ 2024-07-11 │ 1 │ 20 │ 40 │ │ 199 │ 15 │ 2024-07-11 │ 2 │ 5 │ 5 │ │ 215 │ 15 │ 2024-07-11 │ 5 │ 20 │ 30 │ │ 220 │ 15 │ 2024-07-11 │ 7 │ 30 │ 40 │ │ 236 │ 15 │ 2024-09-06 │ 1 │ 20 │ 60 │ │ 238 │ 15 │ 2024-09-06 │ 2 │ 30 │ 35 │ │ 248 │ 15 │ 2024-09-06 │ 5 │ 5 │ 35 │ │ 254 │ 15 │ 2024-09-06 │ 7 │ 50 │ 90 │ │ 267 │ 15 │ 2025-05-04 │ 1 │ 10 │ 70 │ │ 273 │ 15 │ 2025-05-04 │ 2 │ 10 │ 45 │ │ 282 │ 15 │ 2025-05-04 │ 5 │ 10 │ 45 │ │ 287 │ 15 │ 2025-05-04 │ 7 │ 30 │ 120 │ │ 292 │ 15 │ 2025-05-04 │ 8 │ 10 │ 0 │ │ 297 │ 15 │ 2925-05-04 │ 3 │ 10 │ 0 │ └─────┴──────────┴────────────┴───────┴─────────────┴────────────┘ 24 rows, 5 columns Number of Rows 24 0: 5 1: 80 2: 1 3: 1 4: 1 5: 3 6: 3 7: 1 8: 6 9: 1 10: 1 11: 1 12: 1 13: 10 14: 50 15: 1 16: 2 17: 1 18: 3 19: 8 20: 5 21: 3 22: 7 23: 2 24: 1
2
0
77
May ’25
Use AVPlayer for multiple videos
I'm developing a tutorial style tvOS app with multiple videos. The examples I've seen so far deal with only one video. Defining the player and source(url) before body view let avPlayer = AVPlayer(url: URL(string: "https://domain.com/.../.../video.mp4")!)) and then in the body view the video is displayed VideoPlayer(player: avPlayer) This allows options such as stop/start etc. When I try something similar with a video title passed into this view I can't define the player with this title variable. var vTitle: String var avPlayer = AVPlayer(url: URL(string: "https://domain.com/.../.../" + vTitle + ".mp4"")!)) var body: some View { I het an error that vTitle can't be used in the url above the body view. Any thoughts or suggestions? Thanks
1
0
753
Dec ’24
Allow network access in tvOS app
I have a TVML style app on the app store that no longer seems to work. I'm working on converting it to SwiftUI after seeing the WWDC video "Migrate your TVML app to SwiftUI". I've got most of the code working up until I'm trying to display video from a remote source (my website). It looks like the network connection is blocked, maybe. On a macOS app I see a App Sandbox capabilities that include Network access. I don't see that option for the tvOS app. Am I missing something or is it not needed, and I should look elsewhere? Thanks, David
1
0
522
Dec ’24
pkgbuild giving signing identity error
The actual error: pkgbuild: error: Could not find appropriate signing identity for “Developer ID installer: My Name (DeveloperID)”. I'm trying to sign a program written with gfortran. The steps worked the last time (Mar 23) I built this code. The steps to error: a) xcrun notarytool store-credentials --apple-id "xxx" --team-id "yyy" Giving Profile Name zzz and App-specific password b) codesign --force --timestamp --options=runtime -s "Developer ID Application: My Name (yyy)" AppName c) pkgbuild --root ROOT --identifier org.aaa.bbb --version "1.1.1" --sign "Developer ID installer: My Name (yyy)" AppName.pkg ROOT contains the package contents At this point I get the error pkgbuild: error: Could not find appropriate signing identity for “Developer ID installer: My Name (yyy)” Are there steps that have changed. Any suggestions? Thanks, David
Topic: Code Signing SubTopic: General Tags:
1
0
669
Oct ’24
Unable to dismiss an Immersive Space since none is opened
I'm just starting with Immersive Spaces. I am able to view one immersive space but when I tried to open a different one (after restarting the app) I got an error that only one space can be opened (at a time). I added before the openImmersiveSpace call. Now I see a warning shown in the post title. That is Unable to dismiss an Immersive Space since none is opened The app still works but it would be nice to detect when a Space is open so I could check and only close the 'old' space when present before opening the 'new' space. Any suggestions? Thanks. David
0
0
538
Mar ’24
Trying to find button pressed but focusedItem is deprecated
In a tvOS app I have two buttons and would like to determine which one has focus when selected. Using func pressesBegan works for nw. override func pressesBegan(_ presses: Set<UIPress>, with event: UIPressesEvent?) { guard let selected = UIScreen.main.focusedItem else { return } Xcode tells me that focusedItem is deprecated and I should use -[UIWindowScene focusSystem].focusedItem instead. Any suggestions on a code snippet that could be used. Thanks
0
0
576
Dec ’23
Reset GameCenter scores
Is it possible to remove/reset GmeCenter scores for my game app? I'd like to remove all scores so new users can start to compete. Is this possible? The games are educationally based and I'fd like to reset score for a new class.
0
0
642
Aug ’23
Fatal error: UnsafeRawBufferPointer with negative count
I'm using Xcode 14.1 to start a Core Data project. I created a new Project, checking CoreData. The resulting program works in Preview and in the Simulator. I've changed the data from a Item/timestamp to Locations/title. I plan to add more Attributes but that's for later. I think I've got all the Item instances changed to Locations and timestamp to title. It seems to work OK when in Preview for ContentView.swift but crashes in the Simulator with the error Swift/UnsafeRawBufferPointer.swift:946: Fatal error: UnsafeRawBufferPointer with negative count Any suggestions on what I have done wrong? Thanks. PS, the New Project includes the line Text("Select a location") but Select a location doesn't appear in the Preview.
1
1
1.4k
Nov ’22
Upload update of transferred App
I was able have an app transferred from another AppleID to my personal AppleID. The transfer seemed to go OK (https://help.apple.com/app-store-connect/#/deved688524f) however there seems to be a problem now when I try to update the app. I've changed 'ownership' where I can see but when I uploaded the new version, the old bundleID no longer matches my new AppleID format. Do I keep the old bundleID? I'd prefer not delete and recreate the app. That was why I chose the transfer method. Any suggestions, thanks,. David
0
0
954
May ’22
Problem notarizing a pkg containing fortran programs
HI I've updated my fortran program and I'm trying to get through the notarizing process. I created a pkg with >pkgbuild ... I signed the package with >productsign ... I created an application password for notarytool I created store credentials with >xcrun notarytool store-credentials ... Received: Success. Credentials validated. Credentials saved to Keychain. Requested notarization with >xcrun notarytool submit ... Submission ID received Successfully uploaded file Current status: Waiting.... after a minute or two this changed to Current status: Invalid... Could this because the notarizing system doesn't understand Fortran executables or is there something else I've done incorrectly? I have a submission id, is there a way to get more information. Thanks, David
2
0
807
Apr ’22
appledoc is required for building ResearchKit's documentation.
I've run into this problem before but can't resolve this time.I've downloaded researchKit using git clone -b stable https://github.com/ResearchKit/ResearchKit.gitBuilt it and added it to the ORKCatalog sample. On building that sample I get the error "appledoc is required for building ResearchKit's documentation. See http://appledoc.gentlebytes.com"Any suggestions? Thanks
2
0
1.9k
May ’16