swift Questions

2

Solved

I've been experimenting with GCD priorities recently. Here's the snippet of code that I've been working with. for _ in 1...1000 { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_...
Speckle asked 30/8, 2016 at 18:51

3

Solved

Been pulling my hair for the past week. What I've learned: Notification sound works on iOS, not macOS Files on ~/Library/Sound (notice the tilde, it's outside the project folder): Some (not a...
Gamone asked 23/5, 2020 at 19:54

2

Consider the following, relatively simple Swift program: import Foundation func printContext(function: String = #function, line: Int = #line) { print("At \(function):\(line): Running on \(Th...
Kalgan asked 31/8, 2022 at 20:2

1

How can I convert Codable struct to a JSON Data object and keep the order of the struct variables? I know that Dictionary is not ordered and that JSONEncoder and JSONSerialization.data accepts only...
Moderato asked 10/11, 2020 at 20:1

3

Solved

Context I have a Mac app that uses the old QuickLook protocols: QLPreviewPanelDataSource and QLPreviewPanelDelegate. You select a row in an NSTableView, hit the spacebar, and you get the QuickLook ...
Transverse asked 11/9, 2023 at 22:39

5

Solved

I am trying to prevent a popup from being dismissed when the user taps outside of the popup. I have seem other questions/answers about this, and they all seem to suggest using the modalInPopover fo...
Gwin asked 30/8, 2016 at 19:44

4

Solved

I've implemented a List with a search bar in SwiftUI. Now I want to implement paging for this list. When the user scrolls to the bottom of the list, new elements should be loaded. My problem is, ho...
Giarla asked 22/1, 2020 at 21:18

2

Solved

I Am using UICollectionViewCompositionalLayout to create dynamic width, fixed height, tag cell type of layout in some sections of my collectionview. When i add a new string to an array in my databa...

1

I have a view controller that displays a collection view with self-sizing cells. The collection view has one section that scrolls horizontally. It looks like this: Problem The collection view b...

2

Solved

I am getting the following error when trying to integrate App Check into my iOS app. AppCheck failed: 'The operation couldn’t be completed. The attestation provider AppAttestProvider is not support...
Stannite asked 18/7, 2022 at 19:16

3

Solved

Inside a widget, there is a button, Button(intent: AnAppIntent()) { // Button's label. } // It seems this modifier does not add any value. .invalidatableContent() connected to an AppIntent. struc...
Malicious asked 27/6, 2023 at 15:20

2

Solved

With NSManagedObject there are a few hooks like awakeFromInsert() and willSave() among others. Are there methods to override that can serve the same function? awakeFromInsert can be replaced with t...
Misfire asked 26/7, 2023 at 14:10

6

Solved

How to get the current date in unix-epoch? timeIntervalSince1970 prints the current time. Is there any way to get today's time at 12 AM? For example, The current time is : Jan 7, 2018 5:30 PM. tim...
Stepheniestephens asked 8/1, 2019 at 1:10

7

Solved

I have a view controller with a child view controller. tab bar controller | | nav controller | | UIPageViewController (should rotate) | | A (Video Player) (shouldn't rotate) | | B (Controls overla...
Tuba asked 2/2, 2015 at 12:44

3

When I add a UILabel with text to a UIView and then scale the UIView, the contents is displayed with pixelation. The greater the scale factor, the greater the pixelation. I understand using a CATe...
Pasticcio asked 10/10, 2017 at 2:26

2

Solved

I am using a CADisplayLink as a timer in my application. I am using a CADisplayLink because my app relies HEAVILY on the accuracy/precision of the CADisplayLink. NSTimer is not a suitable replaceme...
Extraversion asked 13/3, 2016 at 23:50

4

Solved

I'm trying to have a vertically growing TextField in `SwiftUI but also have the software keyboard have a custom submission method. This uses the new functionality of iOS 16's TextFields being able ...
Lytton asked 3/2, 2023 at 2:47

3

Solved

I see frequent mention that Swift arrays, due to copy-on-write, are not threadsafe, but have found this works, as it updates different and unique elements in an array from different threads simulta...
Composition asked 15/2, 2023 at 12:1

3

Solved

I have a very strange problem: "Can't find the type RCTResponseSenderBlock in scope." It's strange, because in one case it is there and in the other it doesn't, looks like a bug. This is ...
Allynallys asked 23/10, 2020 at 13:47

7

Hello My App is already on app store uploaded with same method archive project and upload it , now i have done some little bit changes, so when ever now i archive project it got stuck on some point...
Lei asked 9/4, 2019 at 6:42

3

Solved

I like to recreate a toolbar similar to Apples Notes App using SwiftUI in a macOS app (I am using Xcode 12.3 and macOS 11.1): My attempt was to use a Navigation View to get the Master/Detail setup...
Litalitany asked 26/12, 2020 at 9:4

4

Solved

By default, on a macOS app using SwiftUI the window size is not restored after the window is closed. Is there a way to keep whatever size & position the user gave before closing the app. Essent...
Hale asked 17/3, 2022 at 2:30

2

I'm using NSPersistentCloudKitContainer to synchronise data between different devices with CloudKit. It works perfectly well with a new project, however when I'm using it with old projects the old ...
Allocution asked 3/7, 2019 at 18:10

5

Solved

Right now, I am in the process of converting from UIKit to SwiftUI. In UIKit, there is a native Close, X-Styled Button - UIButton.ButtonType.close, like shown below: I wanted to find the equivalen...
Xanthene asked 10/8, 2022 at 8:4

2

Solved

If I create a Menu in SwiftUI (iOS), I cannot set the color of the Buttons inside, e.g.: Menu("Actions") { Button(action: { }) { Label("Whatever", systemImage: "pencil&qu...
Dibbuk asked 18/2, 2021 at 11:56

© 2022 - 2025 — McMap. All rights reserved.