Category "swift"

Loading docx file into NSAttributesString not showing images (MacOS Swift)

I am loading docx data into an NSAttributedString, and then rendering it into an NSTextView. It mostly works, but it does not load the images, I checked the att

Reverse Array Queries

For a given array of integers, perform operations on the array. Return the resulting array after all operations have been applied in the order given. Each opera

Custom UIButton -> part of title disappears after click

I created custom button subclassing UIButton. I set custom font for titleLabel. After tapping on custom button, the part of title disappears. Without setting cu

SwiftUI, apply drawGesture only when over Image

I'm try to apply the gesture only when the user is over the Image display not when tapped outside the image. Any suggestion how I can do? this following code dr

Data not updated in TableView after searchBarSearchButtonClicked

I have the following code to search a database for recipes then return that data to my View Controller: var discoveredRecipe: RecipeDiscovered? = nil func sear

how to analyse crash report

i need to collect crash reports, but i don't understand them. For testing purposes i make the app crash with just these 2 lines in a viewDidLoad(): var test:Str

how to analyse crash report

i need to collect crash reports, but i don't understand them. For testing purposes i make the app crash with just these 2 lines in a viewDidLoad(): var test:Str

Adding attribute to markdown NSAttributedString goes out of bounds

I have user input which can contain markdown or not. I want to show the user input on screen with rendered markdown. For some reason, I want to add my own stati

How to navigate between NavigationLink while leave a part of main window stay the same in SwiftUI

I would like to navigate between different NavigationLinks in NavigationView while some part of the main window stay the same. For example, I want to make a mus

How to navigate between NavigationLink while leave a part of main window stay the same in SwiftUI

I would like to navigate between different NavigationLinks in NavigationView while some part of the main window stay the same. For example, I want to make a mus

async/await, Task and [weak self]

Okay so we all know that in traditional concurrency in Swift, if you are performing (for example) a network request inside a class, and in the completion of tha

How to use array of ForEach in SwiftUI

I would like to create an array with a ForEach loop. Something like this : let a = [ ForEach(b) { c in "create the element in the array" } ] H

Using UIBarButtonItemAppearance have both the system and the custom back button images

I am using UIBarButtonItemAppearance for the first time and I'm confused on how to put a custom image for the back button. This is how I do it: private func cre

Extension function is inaccessible due to 'internal' protection level

So I have this lovely extension that would allow me to write conditional view modifiers to my views, made by Antoine van der Lee https://www.avanderlee.com/swif

Swift Combine dependent API Calls

I have 3 API call, all of them are being called using Publishers. API A & API B will be called first before API C got called. But API C should be called onl

Swift tabBar not displaying correctly

In Xcode I have this app that uses tabBarItem. There are 5 items and occasionally when I'm on a specific page I get this weird overlay of the tabBarItems (see p

Swift: Array of Dictionaries get nested value

I'm need help in Swift, hope someone here can help me, I'm new and I don't understand exactly how to get values out of a nested JSON. this is what I have. In th

Metal Ray Tracing – SceneKit or RealityKit

The WWDC21 talk below shows how to "Enhance your app with Metal ray tracing". How can I add Metal ray tracing to a SceneKit or RealityKit app? Any basic example

Replicate UIView motion effects on sprite nodes

Views on Swift have a special property that allows them to add effects to it, which looks like this: view.addMotionEffect(interpolatingEffectCombined) Note tha

How to convert a date string with optional fractional seconds using Codable in Swift?

I am replacing my old JSON parsing code with Swift's Codable and am running into a bit of a snag. I guess it isn't as much a Codable question as it is a DateFor