Questions tagged [swift]
Swift is a general-purpose programming language developed by Apple Inc first released in 2014 for its platforms and Linux. Swift is open-source. Use the tag only for questions about language features or requiring code in Swift. Use the tags [ios], [ipados], [macos], [watch-os], [tvos], [swiftui], [cocoa-touch], and [cocoa] for (language-agnostic) questions about the platforms or frameworks.
swift
48
questions
-1
votes
0
answers
33
views
How to move between view controllers with using custom navigation controller? [closed]
I have a custom navigation controller. I want to go to next controller. And show custom back button. I use this code to do it:
func collectionView(_ collectionView: UICollectionView, didSelectItemAt ...
-1
votes
1
answer
58
views
How to use a function outside of the class?
I want to use this code:
var buttonNumber = 0
func settings() {
CNavigationViewController().contextMenu()
}
class CNavigationViewController: UINavigationController {
...
@objc func ...
1
vote
1
answer
28
views
How can I mock an Objective-C class from Swift code for unit testing?
I'm trying to unit test a Swift class that depends on an Objective-C class. Call these SwiftClass and ObjcClass.
I created a protocol that contains the methods/properties of ObjcClass that SwiftClass ...
0
votes
2
answers
49
views
Parent view ignore safe area but child view respect safe area
I am building a custom full screen cover that can be dragged down with a gesture like the podcast app.
For the transition modifier with edge as bottom, it uses the bottom edge of the parent view thus ...
0
votes
1
answer
59
views
Managing ViewModels
This is more of an architectural question.
I am working on a personal project using the Rick and Morty API, following this design, building with Swift and SwiftUI using the MVVM pattern.
I have ...
-2
votes
0
answers
38
views
How to integrate SwiftBullet SDK in a Swift project using Xcode?
I am new to Swift and Xcode, and I'm currently trying to integrate the SwiftBullet SDK into my SwiftUI project. I have followed the documentation, but I haven't been able to achieve the desired ...
-3
votes
0
answers
20
views
How can I create a Numbers spreadsheet programmatically using Swift? [closed]
I want to have ability for my app to export data so user can print it.
Data represented as list of words.
I am thought about .xlsx format but didn't found easy way to do it.
Is any API or Lib or any ...
0
votes
1
answer
55
views
How can I make my method async when it calls a library method requiring a completion?
In my app I'm using a third party library, AppGuard, to log users in. To do so the library has a method that takes a completion. Recently I got the suggestion to convert it to async/await as actors ...
-1
votes
0
answers
22
views
How to call "AutoFill Password" dialog like click password button in iOS system keyboard?
I want call "AutoFill Password" dialog like click password button in iOS system keyboard. Is Any iOS API can do that?
I've try using ASAuthorizationPasswordRequest and ...
0
votes
1
answer
37
views
iOS Notification is permanently denied - can't find in settings for manual enabling
I implemented push notification in iOS and android, using APN Apple Push notification and firebase respectively. In iOS first request for notification is from native side (appDelegate/swift code) and ...
0
votes
0
answers
36
views
App crashing when task switches to another app and goes to background when a task is ongoing
I have a view that is set to disappear after 5 seconds and it's working okay normally aside from this scenario:
user does the action that makes the view show
user immediately switch to another app ...
0
votes
0
answers
15
views
Lagging Video Feed Using VNGeneratePersonSegmentationRequest in macOS Camera Extension App
I'm developing a macOS application using Swift and a camera extension. I'm utilizing the Vision framework's VNGeneratePersonSegmentationRequest to apply a background blur effect. However, I'm ...
0
votes
0
answers
39
views
Custom Scroll View Indicator does not animate correctly
I created a custom scrollview indicator that can be dragged but it doesn't work completely right and it's not smooth. It has a few problems: Scroll End does not fire when the scroll view stops so the ...
1
vote
0
answers
26
views
Swift faster way to retrieve exif data from PHAsset
I'm working on a photos app on iOS, where I have to extract the camera information of user's photos for displaying.
The problem I am facing is that the process turns out to be extremely slow and ...
1
vote
1
answer
49
views
Update values in a dictionary based on changes made to another dictionary
I would like to know if there is a way to automatically update the value in a dictionary based on changes made to values in another dictionary.
I have 2 dictionaries as follows:
enum ...