Hi, I am fairly new Xcode/Swift and am trying to load a CSV File for use in my development. I have placed the CSV file in my Assets folder but when I try to create my Data Model and load the CSV file. I run into the error: No exact matches in call to initializer. Below is the code. I have attached CSV File. Any help fixing this error would be greatly appreciated. Thanks in advance for your help. Brian Hospital_Demographic_Data_Sample.csv import Foundation import CSV struct HospitalData: Codable { let providerNumber: String let hospital: String let address: String let city: String let state: String let zip: String let wageIndex: Double let caseMix: Double let averageCharge: Double let discharges: Int let totalCharges: Double let adjTotalCharges: Double // Add other fields as needed based on the columns in your CSV file } func loadHospitalData() -> [HospitalData]? { guard let filePath = Bundle.main.path(forResource: Hospital_Demographic_Data, ofType: csv) else { print(File not found) return nil } do
Search results for
column
2,047 results found
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Having done this ... how can you update a column in a DataFrame ?
Topic:
App & System Services
SubTopic:
General
Tags:
Hi I just released an app which is live. i have a strange issue: while the audio files in the app play fine on my device, but some users are unable to hear. One friend said it played yesterday but not today. Any idea why? The files are mp3, I see them in Build Phase, and in the project obviously. Here's the audio view code, thank you! import AVFoundation struct MeditationView: View { @State private var player: AVAudioPlayer? @State private var isPlaying = false @State private var selectedMeditation: String? var isiPad = UIDevice.current.userInterfaceIdiom == .pad let columns = [GridItem(.flexible()),GridItem(.flexible())] let tracks = [Intro:intro.mp3, Peace : mysoundbath1.mp3, Serenity : mysoundbath2.mp3, Relax : mysoundbath3.mp3] var body: some View { VStack{ VStack{ VStack{ Image(dhvani).resizable().aspectRatio(contentMode: .fit) .frame(width: 120) Text(Enter the world of Dhvani soundbath sessions, click lotus icon to play.) .font(.custom(Times New Roman, size: 20)) .lineLimit(nil) .multilineTextA
Topic:
Media Technologies
SubTopic:
Audio
Hello reader, I am facing an issue that I am not able to resolve. I have been able to create a demo project that demonstrates the issue, which I hope enables you to have a look as well and hopefully find a way to resolve it. What is the issue: I am using SKTileMapNode in order to draw tile maps. Instead of using the tilesets as you can use from within the Xcode editor, I prefer to do it all programmatically using tilesheets (for a plethora of reasons that I will leave out of this equation). This is the code of the gameScene: import SpriteKit import GameplayKit class GameScene: SKScene { private let tileSize = CGSize(width: 32, height: 32) override func didMove(to view: SKView) { super.didMove(to: view) let tileSet = createTileSet() let tileMap = SKTileMapNode(tileSet: tileSet, columns: 100, rows: 100, tileSize: tileSize) for column in 0.. SKTileSet { let tileSheetTexture = SKTexture(imageNamed: terrain) var tileGroups = [SKTileGroup]() let relativeTileSize = CGSize(width: tileSize.width/tile
I have a document app built using SwiftData because frankly I'm too lazy to learn how to use FileDocument. The app's title is Artsheets, and I'm using a document type that my app owns: com.wannafedor4.ArtsheetsDoc. The exported type identifier has these values: Description: Artsheets Document Identifier: com.wannafedor4.ArtsheetsDoc Conforms to: com.apple.package Reference URL: (none) Extensions: artsheets MIME Types: (none) And the code: ArtsheetsApp.swift import SwiftUI import SwiftData @main struct ArtsheetsApp: App { var body: some Scene { DocumentGroup(editing: Sheet.self, contentType: .package) { EditorView() } } } Document.swift import SwiftUI import SwiftData import UniformTypeIdentifiers @Model final class Sheet { var titleKey: String @Relationship(deleteRule: .cascade) var columns: [Column] init(titleKey: String, columns: [Column]) { self.titleKey = titleKey self.columns = columns } } @Model final class Column: Identifiable { var titlekey: String
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags:
Swift Packages
Uniform Type Identifiers
SwiftData
Step-by-Step Guide to Fixing the Issue 1- Open Your Project in Xcode 16 or Higher Make sure you have updated to Xcode 16 to access the new features. 2- Navigate to the App Icon Asset In the project navigator, go to Assets.xcassets and select your AppIcon asset. 3- Add Appearance Options In the App Icon editor, you will see a new “Appearance” column. By default, this is set to “None.” Click the “+” icon and add both “Light” and “Dark” options. 4- Configure the Icons for Each Appearance For the “Light” appearance, use your existing app icons. For the “Dark” appearance, you can use the same icons as the Light mode. Simply copy the icons and paste them into the corresponding slots under the “Dark” column. 5- Test the Changes Run the app on a device with iOS 18 and toggle between Light and Dark modes to ensure the icons appear correctly in all scenarios, including the home screen and the iOS Settings app. 6- Build and Deploy Once you confirm that the app icon looks good in both modes, build and d
Topic:
Accessibility & Inclusion
SubTopic:
General
Hello. My project includes a widget target that provides interactive widget functionalities. The document Adding Interactivity to Widgets and Live Activities says the following: Additionally, note that the perform() function is marked as throws. Be sure to handle errors instead of rethrowing them, and update your app, widget, and Live Activity as needed. For example, update a widget’s interface to indicate that it displays outdated information if it cannot load new data. https://developer.apple.com/documentation/widgetkit/adding-interactivity-to-widgets-and-live-activities#Implement-the-perform-function, column 3 However, I couldn't find a way how to handle an error in an interactive widget. The Button(intent:) and Toggle(intent:) initializers don't have mechanisms for error handling. Does anyone know a solution for handling errors in interactive widgets?
I've looked at lots of Grid examples. I've seen it documented that views within a GridRow are treated as if they were in an HStack. That's not happening for me. I have to explicitly put them into an HStack or they are treated as new rows. Here's my code: @State private var gridRows : Int = 4 @State private var gridCols : Int = 2 @State private var myItems : [Int] = Array(0...8) var body: some View { Group { if myItems.count > 0 { ScrollView([.vertical]) { Grid(alignment: .leading) { ForEach(0..<<--- { ForEach(0..
Topic:
UI Frameworks
SubTopic:
SwiftUI
Script error. We've decided to implement certain highly-dynamic content in out iOS codebase using web technologies, here's what we're doing: We download a zip file containing html, javascript, and images. We unzip the archive, construct a WKWebView, and load the content using webView.loadFileURL(indexHtmlUrl, allowingReadAccessTo: parentDirectory) This works fine, but we'd also like to be notified on any rendering errors that might be raised, so we can fix them. let errorHandlerScriptString = (function() { var oldLog = console.log; console.log = function(message) { window.webkit.messageHandlers.consoleLog.postMessage(message); oldLog.apply(console, arguments); } })(); // don't even allow asking for location permissions navigator.geolocation.getCurrentPosition = function(success, error, options) { error({ PERMISSION_DENIED: 1, code: 1 }); }; window.onerror = (msg, url, line, column, error) => { const message = { message: msg, url: url, line: line, column: column, error: JSON.stri
I am encountering an issue with the UndoManager functionality in a SwiftUI application that integrates SwiftData for persistence. This issue occurs specifically in macOS 14 (Sonoma) but works as expected on macOS 15 (Sequoia). The focused test app I have prepared for demonstration allows users to create ParentItem objects, and for each ParentItem, users can add multiple ChildItem objects. The undo functionality (via Cmd+Z) is not working as expected in Sonoma. When I try to undo a ChildItem addition, the UndoManager does not revert just the last ChildItem added, but instead removes all ChildItems that were added in that session. Expected Behavior On macOS 14 (Sonoma), I expect the UndoManager to undo only the most recent transaction (in this case, a single ChildItem insert), similar to how it functions on macOS 15 (Sequoia). Each ChildItem insertion should be treated as a separate undoable action. Current Behavior In macOS Sonoma, pressing Cmd+Z undoes the entire list of ChildItems added to a ParentItem in th
I'm trying to use data returned from the RoomCaptureSession delegate to draw four corners of a door in SceneKit. The CapturedRoom.Surface class has Dimensions and Transform members. I was told in the WWDC 2022 RoomPlan Slack lounge: You can use transform and dimensions parameters to draw lines. The 4 corners can be inferred from those 2 parameters: the first column of the transform is the right vector, and second is the up vector. The fourth column is the position of the wall/door/opening/window/object Combining those unit vectors with the dimensions vector will give you the corners. So I think this is a basic vector question. I'm not sure what is meant by Combining those unit vectors with the dimensions vector. I've tried a few things, but I'm not sure how to go about this.
I have had this notice for a while: Registration is being processed for these devices. They may become available for development and ad hoc distribution in 24 to 72 hours. Changes to device availability will appear in the Status column. The status for my new iPhone has been stuck in this Processing state. See image:
Please first check the validation status of your App Clip, then report the value in the Cache Status column. The Cache Status column shows the validation status for your App Clip as the system performs the validation on people’s devices.
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect
Tags:
Sign in with Apple is not supported in Developer ID apps. The go-to reference for this stuff is Developer Account Help > Reference > Supported capabilities (macOS). Note that Sign in with Apple is not available in the Developer ID column. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
I am using a sandbox account, and I set United States in the region column (Settings>General>Language & Region>Region to US). I added test cards like (American Express and Visa) and the cards added successfully. But I am trying to pay then I get an error like Payment Not Completed. Note: I am trying from India. Please let me know what exactly i am doing mistake here Following code i am using. function onApplePayButtonClicked() { if (!ApplePaySession) { return; } // Define ApplePayPaymentRequest const request = { countryCode: US, currencyCode: USD, merchantCapabilities: [ supports3DS ], supportedNetworks: [ visa, masterCard, amex, discover ], total: { label: Demo (Card is not charged.), type: final, amount: 1.99 } }; // Create ApplePaySession const session = new ApplePaySession(3, request); session.onvalidatemerchant = event => { // Call your own server to request a new merchant session. var merchantSession = merchantValidation(event.validationURL); session.completeMerchantValidation(m