All Questions
3,126 questions
-3
votes
0
answers
70
views
In UIKit, is the behavior of detached Task exactly as described in this example?
I have this code:
func drawCount() {
Task {
await _drawCount()
}
}
func _drawCount() async {
let k = await Task.detached(priority: .low) {
return gfed.filter{$0.blah}....
0
votes
0
answers
39
views
Crash when calling WKHTTPCookieStore.setCookie in async function [closed]
I'm running into a crash when trying to sync cookies from my app to a WKWebView HTTPCookieStore. The crash happens at the setCookie call inside an async function. I'm not sure why it's happening.
The ...
-1
votes
2
answers
102
views
How to decode multiple date formats (ISO8601 string, Unix timestamp, null) into a single Date? using a Swift property wrapper [closed]
I have a Swift model using Codable, and my backend is inconsistent with date formats:
Sometimes a date comes as ISO8601 string ("2025-09-30T04:00:00Z")
Sometimes as a Unix timestamp (...
-3
votes
1
answer
66
views
Is this keyboard-related button on iPad some sort of standard existing system component?
We have a UX where the "paradigm" of a button is similar to this:
so I want to exactly duplicate the look.
Is this something standard available in UIKit, or is it just a UIButton that Apple ...
-5
votes
1
answer
75
views
Layout not called when constraints have been applied, particularly to labels, under a view? (Could be a bug / simulator problem.)
I had a custom UIView V which adds a stack view S with three labels L. It draws some CAShapeLayer lines.
class CustomView: UIView {
///Consumers supply some texts and other info
var input: [ ...
-1
votes
1
answer
93
views
I was disappointed to discover Comparable seems to have no .min call? Is that correct or am I missing something?
I just did this,
1, 5, 100, 2, 7 becomes 5, 100, 7
1, 2, 18, 19, 5, 4 becomes 2, 19, 5
extension Array where Element: Comparable {
///Simply return the bigger of each pair of (say) integers ...
-1
votes
2
answers
68
views
Is it possible to use UIDynamicAnimator with items in a Scroll/StackView, rather than a collection view?
Say you have a vertical collection view, you can add typical "springy" physics by incorporating UIDynamicAnimator in the UICollectionViewLayout.
Simple example below.
Now imagine just a ...
-1
votes
2
answers
64
views
How to call an optional array extension from another?
An extension ...
fileprivate extension Optional {
///Do an upsert for one item - works on all groups
mutating func upsert<T: MyProtocol>(item: T) where Wrapped == [T] {
}
}
which ...
0
votes
1
answer
62
views
When using a CAShapeLayer, is there any advantage at all to using a UIBezierPath over just constructing a cgPath?
When I have
private lazy var aLine: RepairedCAShapeLayer {
let v = RepairedCAShapeLayer()
v.contentsScale = UIScreen.main.scale
v.strokeColor = cfp.color.cgColor
v.fillColor = nil
...
0
votes
1
answer
96
views
Is it correct that copy on write is applied to (all) the "original" array if a change is made to that array while there happens to be a copy extant?
Say
struct Teste: Codable {
let a: Int
lazy var x: Int = {
print("I just changed this Teste item")
return a + 1000
}()
}
and you
var hugeData: [Teste] // 750 ...
0
votes
1
answer
79
views
Animating performBatchUpdates in UICollectionView - how to remove the fade style?
I have a typical ...
"user selects one row, all other rows go away, there is now only one row in the data source, the row's new position is (obviously) now the top and only row: row X slides up ...
0
votes
1
answer
87
views
Why async await compiles with Swift 4.2
I have an iOS project with some async await functions. I update Swift Language Version setting in Xcode Build Settings to 4.2 and the project still able to compile. How Swift 4.2 knows how to compile ...
0
votes
1
answer
64
views
Why does Core Animation have a delay compared to Core Graphics?
I am trying to implement a custom UISlider on an iOS device.
First, the ThumbSlider is positioned on both ends, and the desired behavior is as follows: When the ThumbSlider moves left or right, the ...
5
votes
0
answers
408
views
SecPKCS12Import failed on iOS 17.5, but work well on iOS 18.0
I have been using SecPKCS12Import to retrieve the kSecImportItemIdentity from a .p12 certificate.
While this method works well on iOS 18.0, it returns an error code -25293 on iOS 17.5 or lower.
I use ...
2
votes
1
answer
82
views
Can an enum be an array type?
I often have something like ..
enum DotNetType: String, CaseIterable {
case guid = "Guid"
case int = "Int32"
case float = "Single"
case dateTime = "...