Category "swift"

Linking models to assets on Swift Playgrounds for iPad (no Xcode) -- iOS App Dev Tutorials

StackOverflow. This is my first post. Please excuse any issues with the format. I've been trying to teach myself some iOS development in order to create an app

Encoding Realm models using @Persisted gives a Swift EncodingError message

When trying to encode this: class MyClass: Object, Codable { @Persisted var someValue: String } // I've created and added MyClass to Realm. I then query for

Status bar issue in device dark mode

I am adding an option to add an option for users to choose system/light/dark modes. I am storing user choice in user defaults. Below is my code in AppDelegate a

Editing a TextField in preview

I am trying to add a TextField in SwiftUI. It successfully appears with the initial text, but it is not editable in the preview display, only when I run a simul

Swift UITableView with search bar and perform an Unwind Segue

So I have a UITableViewController with a UISearchBar. I want to simply select a name and then unwind back to the AddTicketTVC with the selected info. This works

Git Clone with Swift Script

I want to clone the team projects into a predefined structure (as they are on the Git) on my local machine. Manually I have to create a new folder for every new

How the remove the yellow bar for "strong password" for SecureFields in SwiftUI?

I am new to SwiftUI and am trying out the SecureFields now. I am using two SecureFields in one VStack and for some reason when I use the iOS keyboard they show

MacOS IOkit get services by property name in Swift

I would like to get all services that contain specific properties. AppleDeviceManagementHIDEventService <class AppleDeviceManagementHIDEventService, id 0x1

Can I mix C++ and Swift in the same swift package, using the Swift Package Manager?

I would like to write one module in C++, and make some functions in C that are accessible in Swift. I am somewhat baffled, because no matter what I do, the SPM

Swift Playgrounds iPad - parse from json Financial Modelling Prep API

G’day I’m trying to pull financial data from the FMP API. import SwiftUI import PlaygroundSupport import Foundation let url = URL(string: "https://

Memory leak issue virtual camera macOS, swift SwiftUI zoom caphost

We are developing a application with virtual camera plugin for macOS by using swiftUI & swift. It has also C++ & objective C library. When we use that p

Transfer object via WatchConnectivity from iOS to watchOS

I am trying to transfer EventKit Data like EKCalendars / EKEvents / EKReminder from iOS to watchOS via WatchConnectivity. The connection works but I cannot push

SwiftUI - Adding a keyboard toolbar button for only one TextField adds it for all TextFields

Background I have two TextFields, one of which has a keyboard type of .decimalPad. Given that there is no 'Done' button when using a decimal pad keyboard to clo

Pass data JSON API to .sheet(isPresented) SwiftUI

How to pass data to .sheet(isPresented) I have 10 names that I get from my JSON API, but when I click on the name, the .sheet(isPresented) shows one name. In al

iOS 15 only view modifier causes crash on iOS 14 even with if #available(iOS 15.0, *)

I'm using SwiftUI's drag & drop modifiers. Since, iOS 15 gives an option to customise the onDrag modifier with a preview I'm using it as shown below. Issue:

Marking makeUIView func makes view NOT conform to UIViewRepresentable?

I am trying to update my map's style URL immediately when the device changes from light/dark mode in my SwiftUI app. The error below shows on every line where "

Swift PDFKit how to scroll to specific point programmatically

I have vertical scrolling pdfView: var pdfView = PDFView() pdfView.displayDirection = .vertical pdfView.usePageViewController(false) pd

SwiftUI Navigation Title Text Priority (of two texts)

I have two texts that I would like to display in a navigation title: ... .navigationTitle(Text(getTitle()) + Text(" (\(selection + 1)/\(sequenceObject.h

SwiftUI: Get sidebar isCollapsed state on macOS

I'm using a NavigationView to create a sidebar on macOS. I can toggle the sidebar using this code: Button { NSApp.keyWindow?.firstResponder?.tryToPerform(

How to convert CMSampleBuffer to OpenCV's Mat instance in swift

I am working on an OpenCV project where I am taking input from iPhone native camera as CMSampleBuffer now I wanted to create Mat instance that is required in Op