id stringlengths 7 11 | source stringclasses 1
value | category stringclasses 11
values | title stringlengths 15 214 | text stringlengths 70 30.5k | url stringlengths 57 160 | tags stringlengths 3 113 | created_at int64 1.22B 1.79B |
|---|---|---|---|---|---|---|---|
se_39028073 | stackoverflow | MOBILE_DEVELOPMENT | Where to store dictionary key for Keychain (Locksmith) | Where to store dictionary key for Keychain (Locksmith)
I'm exploring the Locksmith API (https://github.com/matthewpalmer/Locksmith) for storing data in keychain. I need to store a JSON Web Token within keychain.
I save the token as follows:
try Locksmith.saveData(["someAccountId": "someTokenValue"], forUserAccount:... | https://stackoverflow.com/questions/39028073/where-to-store-dictionary-key-for-keychain-locksmith | swift, keychain | 1,471,557,133 |
se_79909551 | stackoverflow | MOBILE_DEVELOPMENT | Custom DataStoreSnapshot interaction with BackingData and models | Custom DataStoreSnapshot interaction with BackingData and models
I'm trying to implement a custom data store for SwiftData. I've learned a bunch from JSONStore and ProtobufStore.
I'm confused by the DataStoreSnapshot initializer:
init(from: any BackingData, relatedBackingDatas: inout [PersistentIdentifier : any Backin... | https://stackoverflow.com/questions/79909551/custom-datastoresnapshot-interaction-with-backingdata-and-models | swift, swiftdata | 1,773,778,930 |
se_69982225 | stackoverflow | MOBILE_DEVELOPMENT | I'm trying to implement a view stack in swiftui and my @State objects are being reset for reasons that are unclear to me | I'm trying to implement a view stack in swiftui and my @State objects are being reset for reasons that are unclear to me
I'm new to swiftui and doing an experiment with pushing and popping views with a stack. When I pop a view off the stack, the @State variable of the prior view has been reset and I don't understa... | https://stackoverflow.com/questions/69982225/im-trying-to-implement-a-view-stack-in-swiftui-and-my-state-objects-are-being | swift, swiftui | 1,637,019,707 |
se_79908761 | stackoverflow | MOBILE_DEVELOPMENT | Video input to Shortcuts action | Video input to Shortcuts action
I'm trying to develop an AppIntent / action for Shortcuts that accepts a video input that comes from a Photos action (e.g., "Select Photos").
Everything I've read says "IntentFile" is the only appropriate data type, which I have previously used successfully for accepting photo inputs fr... | https://stackoverflow.com/questions/79908761/video-input-to-shortcuts-action | ios, swift, sirishortcuts, appintents | 1,773,690,931 |
se_64519327 | stackoverflow | MOBILE_DEVELOPMENT | can't open Realm using mongodb sync | can't open Realm using mongodb sync
I can't open a Realm. There is something wrong with my set up. This is the code in the app:
var configuration = user.configuration(partitionValue: "user=\(user.id)")
configuration.objectTypes = [User.self]
Realm.asyncOpen(configuration: configuration) { [weak self](userRealm, er... | https://stackoverflow.com/questions/64519327/cant-open-realm-using-mongodb-sync | swift, mongodb, realm | 1,603,586,494 |
se_33500425 | stackoverflow | MOBILE_DEVELOPMENT | How to push view controller onto SLComposeServiceViewController? | How to push view controller onto SLComposeServiceViewController?
This is what I have now:
but I would prefer something like this:
When I tap on the option I push a new UIViewController onto the stack:
This is how my configurationItems() method looks like:
override func configurationItems() -> [AnyObject]! {
... | https://stackoverflow.com/questions/33500425/how-to-push-view-controller-onto-slcomposeserviceviewcontroller | ios, swift, ios8-share-extension | 1,446,557,428 |
se_63331669 | stackoverflow | MOBILE_DEVELOPMENT | Open UIDatePicker programmatically in iOS 14 | Open UIDatePicker programmatically in iOS 14
I have this normal UIDatePicker (sorry that it's not in English, please ignore that):
But the problem is that it only appears when I'm pressing the Date Picker:
And I wanted to know how to show the Date Picker like in the first image (that it's covering all the screen wit... | https://stackoverflow.com/questions/63331669/open-uidatepicker-programmatically-in-ios-14 | swift, uikit, uidatepicker, ios14 | 1,597,009,888 |
se_63740355 | stackoverflow | MOBILE_DEVELOPMENT | UIPasteboard.general.string takes too long | UIPasteboard.general.string takes too long
In my UI test, I have a test where I am using the UIPasteboard to throw the input around. Just before I use it, I store the current value of the pasteboard into a local temporary variable like so: let currentClipboard = UIPasteboard.general.string ?? "" and it will be restore... | https://stackoverflow.com/questions/63740355/uipasteboard-general-string-takes-too-long | ios, swift, xcuitest | 1,599,219,137 |
se_66602675 | stackoverflow | MOBILE_DEVELOPMENT | Using UIGraphicsImageRenderer to resize UIImage to fixed pixel size | Using UIGraphicsImageRenderer to resize UIImage to fixed pixel size
func thumbImage(image: UIImage) -> UIImage {
let cgSize: CGSize = CGSize(width: 100, height: 100)
let thumb = UIGraphicsImageRenderer(size: cgSize)
return thumb.image { _ in
image.draw(in: CGRec... | https://stackoverflow.com/questions/66602675/using-uigraphicsimagerenderer-to-resize-uiimage-to-fixed-pixel-size | ios, swift | 1,615,562,595 |
se_79903594 | stackoverflow | MOBILE_DEVELOPMENT | Extract the selected text in custom iOS keyboard extension | Extract the selected text in custom iOS keyboard extension
I am trying to retrieve the selected text inside a custom keyboard extension.
Using textDocumentProxy.selectedText only provides the prefix and suffix sentences of the selected text, rather than the complete content.
I also tried programmatically moving the cu... | https://stackoverflow.com/questions/79903594/extract-the-selected-text-in-custom-ios-keyboard-extension | ios, swift, ios-keyboard-extension, uiinputviewcontroller | 1,773,029,063 |
se_79907335 | stackoverflow | MOBILE_DEVELOPMENT | Replacing a SFSafariViewController in UITests for an iOS app | Replacing a SFSafariViewController in UITests for an iOS app
I have some flows in my iOS app which require us to open an SFSafariViewController. One such example is a login flow which opens the SFSafariViewController for SSO purposes.
We have a UITest which goes through this flow, opens the SFSafariViewController, we ... | https://stackoverflow.com/questions/79907335/replacing-a-sfsafariviewcontroller-in-uitests-for-an-ios-app | ios, swift, uikit, xcuitest, sfsafariviewcontroller | 1,773,465,987 |
se_79772112 | stackoverflow | MOBILE_DEVELOPMENT | AVAssetWriter creating time code issues in NLEs | AVAssetWriter creating time code issues in NLEs
This is specifically a question about AVAssetWriter in Swift.
I'm not a programmer, so I assume I've got something wrong, but after testing and searching forums and more testing I can't find an answer to my problem.
The problem is that whenever I compress a video file wi... | https://stackoverflow.com/questions/79772112/avassetwriter-creating-time-code-issues-in-nles | swift, avfoundation, avassetwriter, adobe-premiere, timecodes | 1,758,583,070 |
se_79906129 | stackoverflow | MOBILE_DEVELOPMENT | How can I fix an NSRulerView in macOS 26 drawing into/conflicting with the window title bar? | How can I fix an NSRulerView in macOS 26 drawing into/conflicting with the window title bar?
When attaching a vertical ruler to a scroll view the separator is drawn all the way to the top of the window (macOS Tahoe):
Compare this to how it works in previous versions, such as macOS Sequoia (15.7.2):
Is this expected ... | https://stackoverflow.com/questions/79906129/how-can-i-fix-an-nsrulerview-in-macos-26-drawing-into-conflicting-with-the-windo | swift, swiftui, cocoa, macos-tahoe | 1,773,315,312 |
se_79904087 | stackoverflow | MOBILE_DEVELOPMENT | Singleton vs Static FUNCTIONS | Singleton vs Static FUNCTIONS
Suppose I have a function that is used by multiple views. I could create a singleton so the function can be accessed anywhere:
class SharedFunctions {
static let shared = SharedFunctions()
func mySharedFunction() {…}
}
Or I could create a static function:
class SharedFunctions {
... | https://stackoverflow.com/questions/79904087/singleton-vs-static-functions | swift, xcode, swiftui | 1,773,084,066 |
se_7255006 | stackoverflow | MOBILE_DEVELOPMENT | Get System Volume iOS | Get System Volume iOS
My case is simple:
I need to play a warning signal and want to make sure the user will hear it, so I want to check the system volume.
How can I find out what the current system volume is? | https://stackoverflow.com/questions/7255006/get-system-volume-ios | ios, objective-c, swift, audio, volume | 1,314,782,607 |
se_66136043 | stackoverflow | MOBILE_DEVELOPMENT | How to use pipe in Execute command? | How to use pipe in Execute command?
I have an expression like
xattr -p com.apple.metadata:_kMDItemUserTags '/Users/Shared/MeinDesktop/fasttemp/Fotos noch einzusortieren/_ORG/Foto.jpg' | xxd -r -p | plutil -convert json - -o -
I want to execute it in my app. So I tried
func readLabels(_ filePath : String) -> String {
... | https://stackoverflow.com/questions/66136043/how-to-use-pipe-in-execute-command | swift, shell, pipe, execute | 1,612,956,770 |
se_79901365 | stackoverflow | MOBILE_DEVELOPMENT | How to accurately map 2D Vision bounding boxes (CoreML) to 3D world coordinates using ARKit Raycast during a RoomPlan session? | How to accurately map 2D Vision bounding boxes (CoreML) to 3D world coordinates using ARKit Raycast during a RoomPlan session?
I am building an iOS 17 application that integrates Apple's RoomPlan (RoomCaptureSession) with a custom Edge AI model (YOLOv8 via CoreML and Vision framework) to detect structural defects (lik... | https://stackoverflow.com/questions/79901365/how-to-accurately-map-2d-vision-bounding-boxes-coreml-to-3d-world-coordinates | ios, swift, arkit, coreml, roomplan | 1,772,695,435 |
se_70432726 | stackoverflow | MOBILE_DEVELOPMENT | Notification service extension not called on flutter iOS | Notification service extension not called on flutter iOS
Issue:- When getting remote notification have to show image using the imageurl in payload. In Android it’s working fine once we changed the payload. In iOS image not showing in push notification.
Issue facing on Notification Service Extension:- I have added the ... | https://stackoverflow.com/questions/70432726/notification-service-extension-not-called-on-flutter-ios | ios, swift, flutter, rich-notifications | 1,640,076,648 |
se_32065399 | stackoverflow | MOBILE_DEVELOPMENT | Accessing TabBarController | Accessing TabBarController
I have a TabBarController with 5 icons. In all 5 ViewControllers I have redundant code to update the badges of the TabBarController.
This is my redundant code:
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
self.latestTableOverView.reloadData()
... | https://stackoverflow.com/questions/32065399/accessing-tabbarcontroller | ios, swift | 1,439,880,448 |
se_57668997 | stackoverflow | MOBILE_DEVELOPMENT | Property wrappers and SwiftUI environment: how can a property wrapper access the environment of its enclosing object? | Property wrappers and SwiftUI environment: how can a property wrapper access the environment of its enclosing object?
The @FetchRequest property wrapper that ships with SwiftUI helps declaring properties that are auto-updated whenever a Core Data storage changes. You only have to provide a fetch request:
struct MyVie... | https://stackoverflow.com/questions/57668997/property-wrappers-and-swiftui-environment-how-can-a-property-wrapper-access-the | swift, swiftui | 1,566,888,304 |
se_70241691 | stackoverflow | MOBILE_DEVELOPMENT | Working MPMediaPickerController functions Started to give error but Why? | Working MPMediaPickerController functions Started to give error but Why?
I was using followings to pick audio in my app but started to get error and I can not now. Is there anyone have the same issues.
To set picker I was using
func selectAudioFromIpod() {
let picker = MPMediaPickerController.init(mediaTypes:M... | https://stackoverflow.com/questions/70241691/working-mpmediapickercontroller-functions-started-to-give-error-but-why | swift | 1,638,772,969 |
se_79905083 | stackoverflow | MOBILE_DEVELOPMENT | Extract video frames sequentially so each frame represents the next scene segment | Extract video frames sequentially so each frame represents the next scene segment
I am processing a video and need to extract frames that represent
consecutive portions of the scene.
The requirement is that each extracted frame should correspond to
the next part of the scene relative to the previous frame, so that
the... | https://stackoverflow.com/questions/79905083/extract-video-frames-sequentially-so-each-frame-represents-the-next-scene-segmen | swift, uikit, avfoundation | 1,773,208,460 |
se_79905268 | stackoverflow | MOBILE_DEVELOPMENT | Why Sendable Conformance is not forced | Why Sendable Conformance is not forced
In the code below I have the actor BankAccount and the non-sendable type AlternativeBankAccount. Both have the same body.
I cannot understand why the compiler does not trigger a warning when passing an AlternativeBankAccount to the charge function. The asynchronous context chang... | https://stackoverflow.com/questions/79905268/why-sendable-conformance-is-not-forced | swift, swift-concurrency, sendable | 1,773,224,168 |
se_63926305 | stackoverflow | MOBILE_DEVELOPMENT | Combine previous value using Combine | Combine previous value using Combine
How can I rewrite ReactiveSwift/ReactiveCocoa code using Combine framework? I attached screenshot what combinePrevious mean from docs.
let producer = SignalProducer<Int, Never>([1, 2, 3]).combinePrevious(0)
producer.startWithValues { value in
print(value) // print: (0, 1), (1, ... | https://stackoverflow.com/questions/63926305/combine-previous-value-using-combine | swift, reactive-cocoa, combine, reactive-swift | 1,600,282,364 |
se_79905080 | stackoverflow | MOBILE_DEVELOPMENT | My Xcode Bridging Header doesn't seem to include my Swift class | My Xcode Bridging Header doesn't seem to include my Swift class
I think have done everything by the book.
I added a small Swift file to my Objective-C project. This is code in the project, not in a framework, so I did not use the public keyword:
import Foundation
@objc TestClass: NSObject {
@objc init(){}
}
... | https://stackoverflow.com/questions/79905080/my-xcode-bridging-header-doesnt-seem-to-include-my-swift-class | swift, objective-c, bridging-header | 1,773,208,244 |
se_79904809 | stackoverflow | MOBILE_DEVELOPMENT | How to combine an Image Button, Action and Navigation Link together? | How to combine an Image Button, Action and Navigation Link together?
I am trying to understand how to make a button execute an action and navigate to a new UI, like so (the code below is inside a simple Struct):
Button(action: {
print("I am new to SwiftUI!")
buttonFunction()
}) {
Na... | https://stackoverflow.com/questions/79904809/how-to-combine-an-image-button-action-and-navigation-link-together | swift, swiftui, swiftui-navigationlink | 1,773,166,081 |
se_68460953 | stackoverflow | MOBILE_DEVELOPMENT | How to identify that asset added inside Assets.xcassets are used in project? | How to identify that asset added inside Assets.xcassets are used in project?
How to identify quick way the Assets added inside Assets.xcassets for Images & color are using inside project or not.
Example:
int value = 10
In this case int value not used inside application which give an warning.
Initialization of immutab... | https://stackoverflow.com/questions/68460953/how-to-identify-that-asset-added-inside-assets-xcassets-are-used-in-project | swift, xcode, assert | 1,626,813,028 |
se_79904646 | stackoverflow | MOBILE_DEVELOPMENT | SwiftUI Picker has no background | SwiftUI Picker has no background
My SwiftUI picker ist pretty straight forward. But it shows no background when expanding.
Tried with iPhone 16e with 26.0.1 simulator.
Works with iOS 18.2 with iPhone SE third gen.
NavigationView {
Form {
Section(NSLocalizedString("location_section_title", c... | https://stackoverflow.com/questions/79904646/swiftui-picker-has-no-background | swift, swiftui | 1,773,153,628 |
se_74735318 | stackoverflow | MOBILE_DEVELOPMENT | How to make a hierarchical sidebar in SwiftUI where the sub-elements are a different type than the parents? | How to make a hierarchical sidebar in SwiftUI where the sub-elements are a different type than the parents?
I am trying to make a similar hierarchical sidebar to the macOS Mail app using SwiftUI,
Where you have parent elements, like "All Sent" and then child elements like individual mail boxes, and unlike the typical ... | https://stackoverflow.com/questions/74735318/how-to-make-a-hierarchical-sidebar-in-swiftui-where-the-sub-elements-are-a-diffe | swift, cocoa, swiftui | 1,670,527,199 |
se_79904292 | stackoverflow | MOBILE_DEVELOPMENT | iOS - Modern approach for getting the soft keyboard visibility | iOS - Modern approach for getting the soft keyboard visibility
With the following piece of code, we can have a pretty good idea of when the soft keyboard becomes visible/invisible:
let showingObserver = NotificationCenter.default.addObserver(
forName: UIResponder.keyboardWillShowNotification,
object: nil,
queue:... | https://stackoverflow.com/questions/79904292/ios-modern-approach-for-getting-the-soft-keyboard-visibility | swift, uikit, uikeyboard | 1,773,118,323 |
se_79901141 | stackoverflow | MOBILE_DEVELOPMENT | This video is unavilable | Error code: 152 - 4 | This video is unavilable | Error code: 152 - 4
When trying to show youtube video in my app with embeded way, it shows the error code: 152 - 4.
I just want to make a view where passing the YouTube ID will play the YouTube video inside my app's specific screens/views. Now this error occurs when trying to play the video.... | https://stackoverflow.com/questions/79901141/this-video-is-unavilable-error-code-152-4 | ios, swift, youtube | 1,772,653,549 |
se_79903794 | stackoverflow | MOBILE_DEVELOPMENT | SwiftUI ScrollView with .viewAligned scrollTargetBehavior doesn't scroll to correct index when using buttons | SwiftUI ScrollView with .viewAligned scrollTargetBehavior doesn't scroll to correct index when using buttons
I have a horizontal ScrollView with cells (1-8) and a corresponding horizontal row of buttons above it. The ScrollView uses .viewAligned scroll target behavior with peek cells (neighboring cells partially v... | https://stackoverflow.com/questions/79903794/swiftui-scrollview-with-viewaligned-scrolltargetbehavior-doesnt-scroll-to-corr | swift, swiftui | 1,773,052,435 |
se_74210076 | stackoverflow | MOBILE_DEVELOPMENT | SwiftUI FetchRequest predicate with data from an ObservedObject causes property initialisers run before self is available | SwiftUI FetchRequest predicate with data from an ObservedObject causes property initialisers run before self is available
I use a CoreData Model where a Group Object has GroupMembers(firstName: String) connected with the entity members. GroupMembers have a corresponding property group that connects back to the Group O... | https://stackoverflow.com/questions/74210076/swiftui-fetchrequest-predicate-with-data-from-an-observedobject-causes-property | swift, swiftui, core-data | 1,666,797,008 |
se_79902984 | stackoverflow | MOBILE_DEVELOPMENT | SwiftData EXC_BREAKPOINT when trying to load model data | SwiftData EXC_BREAKPOINT when trying to load model data
I am struggling to resolve a runtime "error" when trying to load model data with SwiftData in my unit tests.
I use the makeModelContext function on the MainActor to create an in-memory model context:
/// Create an in-memory ModelContext containing all app models ... | https://stackoverflow.com/questions/79902984/swiftdata-exc-breakpoint-when-trying-to-load-model-data | swift, swiftdata | 1,772,914,948 |
se_79903007 | stackoverflow | MOBILE_DEVELOPMENT | Only get limited access to contacts on iOS | Only get limited access to contacts on iOS
Anyone have experience with the Contacts/ContactsUI Framework in iOS?
I'm building an app that requires access to user contacts, but I only want limited access (specific contacts only) rather than requesting full contacts permission.
I've looked into Contact Access button, w... | https://stackoverflow.com/questions/79903007/only-get-limited-access-to-contacts-on-ios | ios, swift, iphone, swiftui, contacts | 1,772,921,219 |
se_73183251 | stackoverflow | MOBILE_DEVELOPMENT | How to remove "search web" option for selected text in iOS 16 Xcode14 beta | How to remove "search web" option for selected text in iOS 16 Xcode14 beta
I'm having trouble removing this tick when text is selected, I've tried this:
class CustomUITextField: UITextField {
open override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool {
return false
}... | https://stackoverflow.com/questions/73183251/how-to-remove-search-web-option-for-selected-text-in-ios-16-xcode14-beta | swift, xcode, uitextfield, ios16, xcode14 | 1,659,269,960 |
se_78554904 | stackoverflow | MOBILE_DEVELOPMENT | Why isn't Staged Migration working for my App? | Why isn't Staged Migration working for my App?
I referred to "What's new in Core Data" in WWDC23, CoreData Documentation and other Posts related Staged Migrations.
I added three new model version through MyAppDataModel, using Hash Modifiers for Versioning.
(Because it caused Error for any version has same version ... | https://stackoverflow.com/questions/78554904/why-isnt-staged-migration-working-for-my-app | ios, swift, core-data, core-data-migration, nspersistentcontainer | 1,717,071,527 |
se_77096117 | stackoverflow | MOBILE_DEVELOPMENT | How to achieve a Menu with only Image in SwiftUI for macos? | How to achieve a Menu with only Image in SwiftUI for macos?
What I'm doing
I'm coding a mac App in SwiftUI, where swift is in version of 5.7.2.
What I want to do
Click a image button, and display a drop-down menu.
My question
The following is my code, and there is always a down arrow on the right of the button.
I wond... | https://stackoverflow.com/questions/77096117/how-to-achieve-a-menu-with-only-image-in-swiftui-for-macos | swift, macos, swiftui, menu | 1,694,599,878 |
se_36569008 | stackoverflow | MOBILE_DEVELOPMENT | Trying to fill a screen with Apple Map | Trying to fill a screen with Apple Map
So on my app I have a screen where I want to display a map. Catch here is the map needs to rotate automatically as the user rotates the screen. Similar to when you press the compass button on any map.
I have coded the first part of creating a map and displaying it and rotating wi... | https://stackoverflow.com/questions/36569008/trying-to-fill-a-screen-with-apple-map | ios, swift, rotation, mkmapview | 1,460,453,114 |
se_79901509 | stackoverflow | MOBILE_DEVELOPMENT | Padding on an Stack whose child views can be empty view | Padding on an Stack whose child views can be empty view
Lets say we have an OptionalView that would render a view if a condition is met (we do not know what it is), and otherwise render nothing (resolves body to an empty view).
struct OptionalView: View {
private var random: Int {
(1...5).randomElemen... | https://stackoverflow.com/questions/79901509/padding-on-an-stack-whose-child-views-can-be-empty-view | swift, swiftui, ios15 | 1,772,709,601 |
se_32980281 | stackoverflow | MOBILE_DEVELOPMENT | Counting number of files in Directory with reference counting | Counting number of files in Directory with reference counting
I have a folder of images that were imported with Create Folder Reference method, since I want to call images with URLForResource for transfer to Watch.
Before I transfer Images I would like to count them in folder.
I was able to get folderURL path with thi... | https://stackoverflow.com/questions/32980281/counting-number-of-files-in-directory-with-reference-counting | ios, swift, resources, filesystems, swift2 | 1,444,167,837 |
se_79901311 | stackoverflow | MOBILE_DEVELOPMENT | iMessage Extension: didSelect not called on iPad when tapping same message - any workarounds? | iMessage Extension: didSelect not called on iPad when tapping same message - any workarounds?
I'm building a turn-based iMessage game and hitting a wall with iPad support. Looking for anyone who has solved this.
The Problem
On iPad, didSelect(message:conversation:) only fires the first time a user taps a message bubbl... | https://stackoverflow.com/questions/79901311/imessage-extension-didselect-not-called-on-ipad-when-tapping-same-message-any | ios, swift, ipad, app-store-connect, imessage-extension | 1,772,689,472 |
se_79900922 | stackoverflow | MOBILE_DEVELOPMENT | How can I access a certificate in my iOS app? | How can I access a certificate in my iOS app?
I am building an app with Flutter and am focusing specifically on iOS here. I want to pass a certificate installed on my iOS device to a proxy server with every HTTP request.
I have tried with installing pfx and a p12, and also deployed both a user-targeted and device-targ... | https://stackoverflow.com/questions/79900922/how-can-i-access-a-certificate-in-my-ios-app | ios, swift, client-certificates, intune | 1,772,633,202 |
se_46344963 | stackoverflow | MOBILE_DEVELOPMENT | Swift JSONDecode decoding arrays fails if single element decoding fails | Swift JSONDecode decoding arrays fails if single element decoding fails
While using Swift4 and Codable protocols I got the following problem - it looks like there is no way to allow JSONDecoder to skip elements in an array.
For example, I have the following JSON:
[
{
"name": "Banana",
"points": 20... | https://stackoverflow.com/questions/46344963/swift-jsondecode-decoding-arrays-fails-if-single-element-decoding-fails | arrays, json, swift, swift4, codable | 1,505,999,763 |
se_79900353 | stackoverflow | MOBILE_DEVELOPMENT | How to change vertical alignment of individual items in SwiftUI HStack? | How to change vertical alignment of individual items in SwiftUI HStack?
I have the following code.
struct ContentView: View {
@State var textInput: String = "Testing"
private let inputCornerRadius: CGFloat = 24
var body: some View {
HStack(alignment: .bottom, spacing: 8) {
TextField("... | https://stackoverflow.com/questions/79900353/how-to-change-vertical-alignment-of-individual-items-in-swiftui-hstack | ios, swift, swiftui | 1,772,561,239 |
se_79900380 | stackoverflow | MOBILE_DEVELOPMENT | Swift string truncates / does not hold enough content | Swift string truncates / does not hold enough content
I am trying to build up something that uses wkwebview and javascript..So, I am having terrible issues with strings..
They are way too short, meaning that they don't have enough capacity. I have understood that string's capacity is huge, something like that it could... | https://stackoverflow.com/questions/79900380/swift-string-truncates-does-not-hold-enough-content | ios, swift, string | 1,772,564,355 |
se_55312626 | stackoverflow | MOBILE_DEVELOPMENT | How to create Singleton in generic class? | How to create Singleton in generic class?
I have been trying to convert a singleton class to generic. Since swift doesn't support stored property in generic class Singleton could not be implemented. I tried all the possible solutions that I know but nothing works. Other Stackoverflow answers related to this topic does... | https://stackoverflow.com/questions/55312626/how-to-create-singleton-in-generic-class | swift | 1,553,335,667 |
se_79898637 | stackoverflow | MOBILE_DEVELOPMENT | Custom colors in LineMark? | Custom colors in LineMark?
I'm new to SwiftUI Charts. My basic setup is working fine, except that I need to customize the colors of a multiline chart. The data is coming from two SwiftData classes:
class Parts {
var name: String
var color: Color
…
}
class Orders {
var part: Parts // -> Relationship
var amou... | https://stackoverflow.com/questions/79898637/custom-colors-in-linemark | swift, swiftui, charts | 1,772,318,492 |
se_79898841 | stackoverflow | MOBILE_DEVELOPMENT | Detect closing of tab (NSWindowTab) in WindowGroup | Detect closing of tab (NSWindowTab) in WindowGroup
Situation/Code
I have a SwiftUI app displaying tabbed windows (as NSWindowTab) in a WindowGroup:
import SwiftUI
@main
struct TabTestApp: App {
var body: some Scene {
WindowGroup{
ContentView() // Hasn't any content of relevance to this questio... | https://stackoverflow.com/questions/79898841/detect-closing-of-tab-nswindowtab-in-windowgroup | swift, swiftui, nswindow, swiftui-windowgroup | 1,772,366,270 |
se_79899399 | stackoverflow | MOBILE_DEVELOPMENT | macOS menu bar action | macOS menu bar action
I have seen a lot of tutorials how to customize the menubar, but none of them I found explain how to implement an action, they used leave it as an "exercise for the reader".
For instance:
@main
struct DemoApp: App {
var body: some Scene {
Window("MyApp", id: mainWindowID) {
... | https://stackoverflow.com/questions/79899399/macos-menu-bar-action | swift, macos, swiftui, menu | 1,772,453,463 |
se_63548432 | stackoverflow | MOBILE_DEVELOPMENT | SwiftUI - How to Make A Start/Stop Timer | SwiftUI - How to Make A Start/Stop Timer
My goal is to create a view in SwiftUI that starts with 0. When you press the view, a timer should start counting upwards, and tapping again stops the timer. Finally, when you tap again to start the timer, the timer should begin at 0.
Here is my current code:
import SwiftUI
st... | https://stackoverflow.com/questions/63548432/swiftui-how-to-make-a-start-stop-timer | swift, view, timer, swiftui | 1,598,194,712 |
se_32156910 | stackoverflow | MOBILE_DEVELOPMENT | Swift Pattern match on Array<Any> | Swift Pattern match on Array<Any>
Swift 1.2
I'm trying to pattern match in a switch case in a function that take a type Any as its parameter, in order to dispatch to a private more specialize init.
Here is a Playground extrapolation:
import Foundation
struct myStruct {
}
func switchOnAny(any: Any) -> String {
... | https://stackoverflow.com/questions/32156910/swift-pattern-match-on-arrayany | swift, switch-statement, pattern-matching, swift1-2 | 1,440,251,592 |
se_79899905 | stackoverflow | MOBILE_DEVELOPMENT | SwiftUI: Can I change only the “off” track background color of a native Toggle (Switch) without losing the native appearance? | SwiftUI: Can I change only the “off” track background color of a native Toggle (Switch) without losing the native appearance?
I’m using SwiftUI’s native Toggle with the switch style. I want to change only the off (not-selected) track background color, while keeping the native iOS switch appearance and behaviour.
I tri... | https://stackoverflow.com/questions/79899905/swiftui-can-i-change-only-the-off-track-background-color-of-a-native-toggle | ios, swift, swiftui, switch-statement, toggle | 1,772,521,399 |
se_79890664 | stackoverflow | MOBILE_DEVELOPMENT | Hide dictation (microphone) button in custom iOS keyboard extension | Hide dictation (microphone) button in custom iOS keyboard extension
I’m developing a custom keyboard extension using UIInputViewController. When my keyboard is active on iOS 16+, the system places a dictation (microphone) button at the bottom-right corner of the keyboard area, outside of my extension's view.
I want to... | https://stackoverflow.com/questions/79890664/hide-dictation-microphone-button-in-custom-ios-keyboard-extension | ios, swift, ios-keyboard-extension, uiinputviewcontroller | 1,771,313,374 |
se_79899753 | stackoverflow | MOBILE_DEVELOPMENT | SwiftUI Stacked Sheets with custom detents of different heights | SwiftUI Stacked Sheets with custom detents of different heights
I have a scenario where I need to present a paywall in front of an open sheet - so two sheets stacked at two different heights. Ideally the open sheet would be at half height and the paywall would be at one-third height.
I can get it working using the sy... | https://stackoverflow.com/questions/79899753/swiftui-stacked-sheets-with-custom-detents-of-different-heights | swift, swiftui | 1,772,490,665 |
se_76671579 | stackoverflow | MOBILE_DEVELOPMENT | Swift Zebra TcpPrinterConnection Remains Open | Swift Zebra TcpPrinterConnection Remains Open
I have successfully implemented the Link OS iOS SDK into my Xcode project.
I created a bridging header for the .h files, and I am able to print successfully to our Zebra Printers
I am having an issue where extra tags are being printed. Explained:
Connection is open with I... | https://stackoverflow.com/questions/76671579/swift-zebra-tcpprinterconnection-remains-open | swift, xcode, zebra-printers, zpl | 1,689,171,560 |
se_79899469 | stackoverflow | MOBILE_DEVELOPMENT | Animation bug on list when entering edit mode with swipe to delete disabled | Animation bug on list when entering edit mode with swipe to delete disabled
I'm trying to have an edit button on a list to be able to delete multiple items at the same time without the red delete controls at the start of each row.
To remove the delete controls I use this .deleteDisabled(editMode?.wrappedValue.isEditin... | https://stackoverflow.com/questions/79899469/animation-bug-on-list-when-entering-edit-mode-with-swipe-to-delete-disabled | ios, swift, swiftui, swiftui-list, swiftui-animation | 1,772,459,992 |
se_33369104 | stackoverflow | MOBILE_DEVELOPMENT | Set iOS language without restarting | Set iOS language without restarting
I am aware of quite a few posts that say this should not be done, or is not possible. I tinkered with a few ideas and now I'm asking this question, because I want to be absolutely sure there are no other options.
Option 1:
The most popular solution is to change AppleLanguages as ... | https://stackoverflow.com/questions/33369104/set-ios-language-without-restarting | ios, swift, localization | 1,445,951,937 |
se_79899496 | stackoverflow | MOBILE_DEVELOPMENT | SwiftData Unidirectional Relationships | SwiftData Unidirectional Relationships
I would like to achieve having unidirectional relationships in my SwiftData project (which I believe is possible: https://developer.apple.com/documentation/updates/swiftdata?changes=\_9) but I'm afraid I'm struggling to overcome the errors I'm experiencing.
For example, I have th... | https://stackoverflow.com/questions/79899496/swiftdata-unidirectional-relationships | swift, swiftdata, swift-data-relationship | 1,772,462,637 |
se_79898585 | stackoverflow | MOBILE_DEVELOPMENT | SwiftUI iOS 26 - Toolbar Menu label icon intermittently disappears for ~1 second when Picker selection changes symbolVariant from .none to .fill | SwiftUI iOS 26 - Toolbar Menu label icon intermittently disappears for ~1 second when Picker selection changes symbolVariant from .none to .fill
I have a Menu in a toolbar whose label changes .symbolVariant and .foregroundStyle based on an inline Picker selection. When switching from the default state (no variant, pri... | https://stackoverflow.com/questions/79898585/swiftui-ios-26-toolbar-menu-label-icon-intermittently-disappears-for-1-second | ios, swift, swiftui | 1,772,308,860 |
se_79440937 | stackoverflow | MOBILE_DEVELOPMENT | Looking for way to set a scrollable chart in SwiftUI Charts all the way to the end of the data | Looking for way to set a scrollable chart in SwiftUI Charts all the way to the end of the data
I am doing some prototyping for a chart I want to add to an app. This chart has some integer data on the Y axis and the X axis is by day/date. I am using days since 1970 (off of date.timeIntervalSince1970) as an easy way to ... | https://stackoverflow.com/questions/79440937/looking-for-way-to-set-a-scrollable-chart-in-swiftui-charts-all-the-way-to-the-e | swift, swiftui, charts | 1,739,592,202 |
se_79898278 | stackoverflow | MOBILE_DEVELOPMENT | SwiftUI ScrollView: GeometryReader + PreferenceKey Issues | SwiftUI ScrollView: GeometryReader + PreferenceKey Issues
I’m building a SwiftUI “scoreboard” style UI: a ScrollView with a single pinned header at the top. As you scroll, the pinned header should update to show the currently active section (NBA/NHL/etc), similar to a sticky “current category” label.
My current approa... | https://stackoverflow.com/questions/79898278/swiftui-scrollview-geometryreader-preferencekey-issues | swift, swiftui, scrollview | 1,772,258,285 |
se_54234901 | stackoverflow | MOBILE_DEVELOPMENT | UIDocumentPickerDelegate method(didPickDocumentsAt) not called by iOS | UIDocumentPickerDelegate method(didPickDocumentsAt) not called by iOS
I have a query regarding delegate method not been getting called for DocumentPickerViewController, here's the background, I just need to import the resource whatever available from my Files App and for that reason i am using UIDocumentPickerViewCont... | https://stackoverflow.com/questions/54234901/uidocumentpickerdelegate-methoddidpickdocumentsat-not-called-by-ios | ios, swift, uidocumentpickervc, uidocumentpickerviewcontroller | 1,547,724,310 |
se_33942483 | stackoverflow | MOBILE_DEVELOPMENT | Swift extension example | Swift extension example
I was originally wanting to know how to make something like this
UIColor.myCustomGreen
so that I could define my own colors and use them throughout my app.
I had studied extensions before and I thought that I could probably use them to solve my problem, but I couldn't remember exactly how ... | https://stackoverflow.com/questions/33942483/swift-extension-example | swift, extension-methods | 1,448,552,734 |
se_79898443 | stackoverflow | MOBILE_DEVELOPMENT | CarPlay CPListImageRowItem causes Inverted Scrolling and Side Button malfunction | CarPlay CPListImageRowItem causes Inverted Scrolling and Side Button malfunction
In my CarPlaySceneDelegate.swift, I have two tabs:
The first tab uses a CPListImageRowItem with a CPListImageRowItemRowElement. The scroll direction is inverted, and the side button does not function correctly.
The second tab uses multip... | https://stackoverflow.com/questions/79898443/carplay-cplistimagerowitem-causes-inverted-scrolling-and-side-button-malfunction | ios, swift, carplay | 1,772,288,833 |
se_79891589 | stackoverflow | MOBILE_DEVELOPMENT | Flutter iOS build fails with "Framework 'Pods_Runner' not found" on Xcode 26.2 beta | Flutter iOS build fails with "Framework 'Pods_Runner' not found" on Xcode 26.2 beta
I'm getting a linker error when building my Flutter iOS app on the simulator:
Error (Xcode): Framework 'Pods_Runner' not found
Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)
Environm... | https://stackoverflow.com/questions/79891589/flutter-ios-build-fails-with-framework-pods-runner-not-found-on-xcode-26-2-b | ios, swift, flutter, xcode, xcode26 | 1,771,423,180 |
se_79898412 | stackoverflow | MOBILE_DEVELOPMENT | Color filling doesn't follow the rounding in SwiftUI | Color filling doesn't follow the rounding in SwiftUI
I defined the following shape:
struct DisplayView: View {
var body: some View {
ZStack{
RoundedRectangle(cornerRadius: 20)
.stroke(Color.black, lineWidth: 1)
VStack{
ScrollView {
VStack (spacing: ... | https://stackoverflow.com/questions/79898412/color-filling-doesnt-follow-the-rounding-in-swiftui | swift, xcode, user-interface | 1,772,283,663 |
se_79898350 | stackoverflow | MOBILE_DEVELOPMENT | Implied resultBuilder is lost through protocol conformance via ExtensionMacro | Implied resultBuilder is lost through protocol conformance via ExtensionMacro
I'm pretty sure this one is impossible at the moment but I'll post hoping i'm wrong.
A simple protocol which uses a simple resultBuilder:
@resultBuilder
public enum MyResultBuilder {
public static func buildBlock ( _ components: String..... | https://stackoverflow.com/questions/79898350/implied-resultbuilder-is-lost-through-protocol-conformance-via-extensionmacro | swift, macros, swift6 | 1,772,271,758 |
se_79898339 | stackoverflow | MOBILE_DEVELOPMENT | iOS 26 UIGlassEffect: Corner edge lighting disappears on a rounded rect, but works perfectly on a circle/pill shape. Why? | iOS 26 UIGlassEffect: Corner edge lighting disappears on a rounded rect, but works perfectly on a circle/pill shape. Why?
I'm currently playing around with the new UIGlassEffect in iOS 26, and I've run into a weird visual rendering issue with corners.
The Problem: I'm building a custom dropdown menu (VSCaptureModeDrop... | https://stackoverflow.com/questions/79898339/ios-26-uiglasseffect-corner-edge-lighting-disappears-on-a-rounded-rect-but-wor | ios, swift, ios26, liquid-glass | 1,772,269,807 |
se_61762410 | stackoverflow | MOBILE_DEVELOPMENT | How to connect asyc data fetch using Core NFC and Swift UI? | How to connect asyc data fetch using Core NFC and Swift UI?
I am trying to create a DataModel for my SwiftUI Screen.
The problem I am facing is that I use Core NFC to scan a NFCTag (perform some tasks) and then I want to update the SwiftUI Screen. The data fetch/manipulation occurs asynchronous.
View
struct NFCTest:... | https://stackoverflow.com/questions/61762410/how-to-connect-asyc-data-fetch-using-core-nfc-and-swift-ui | swift, swiftui, combine, core-nfc | 1,589,319,354 |
se_24687238 | stackoverflow | MOBILE_DEVELOPMENT | Changing navigation bar color in Swift | Changing navigation bar color in Swift
I am using a Picker View to allow the user to choose the colour theme for the entire app.
I am planning on changing the colour of the navigation bar, background and possibly the tab bar (if that is possible).
I've been researching how to do this but can't find any Swift example... | https://stackoverflow.com/questions/24687238/changing-navigation-bar-color-in-swift | ios, swift, uinavigationbar | 1,405,030,725 |
se_36323903 | stackoverflow | MOBILE_DEVELOPMENT | How to send a silent Push Notification payload | How to send a silent Push Notification payload
I just want to know how I can determine what action to do on a silent push:
This is the aps that I sent to the client:
"aps": {
"content-available": 1
}
My problem now is when I add type: "Order_Update" to determine that the silent push is for the Order Update to ... | https://stackoverflow.com/questions/36323903/how-to-send-a-silent-push-notification-payload | ios, swift, push-notification, apple-push-notifications | 1,459,396,895 |
se_79897075 | stackoverflow | MOBILE_DEVELOPMENT | RPBroadcastSampleHandler stops immediately after countdown — AVAssetWriter crash on first frame | RPBroadcastSampleHandler stops immediately after countdown — AVAssetWriter crash on first frame
I need help with ReplayKit screen recording using a Broadcast Upload Extension in my React Native Expo (bare) iOS project.
Current situation:
My broadcast extension appears correctly in Control Center under Screen Recording... | https://stackoverflow.com/questions/79897075/rpbroadcastsamplehandler-stops-immediately-after-countdown-avassetwriter-crash | swift, react-native, screen-recording, ios-app-group, rpbroadcastsamplehandler | 1,772,113,233 |
se_75705302 | stackoverflow | MOBILE_DEVELOPMENT | Core Media basics, understanding CMSampleBuffer, CMBlockBuffer and CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer | Core Media basics, understanding CMSampleBuffer, CMBlockBuffer and CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer
So, I'm trying to learn basics of Core Media since I need to process real time audio samples in my app. For now I know that I need to configure an AVCaptureSession setting an AVCaptureDevice used ... | https://stackoverflow.com/questions/75705302/core-media-basics-understanding-cmsamplebuffer-cmblockbuffer-and-cmsamplebuffe | ios, swift, audio, avfoundation, core-media | 1,678,541,756 |
se_79897760 | stackoverflow | MOBILE_DEVELOPMENT | Scan one barcode on button press | Scan one barcode on button press
I am trying to adapt the Vision Framework based scanner proposed by Luca Palmese.
This scanner is scanning all barcodes detected in the camera field and optionally you can stop scanning after the first barcode is detected.
What I'd need is keeping the live video on the screen and start... | https://stackoverflow.com/questions/79897760/scan-one-barcode-on-button-press | swift, swiftui, barcode-scanner, apple-vision, uiviewcontrollerrepresentable | 1,772,190,434 |
se_79835736 | stackoverflow | MOBILE_DEVELOPMENT | Analyzing performance of metal shaders in Xcode | Analyzing performance of metal shaders in Xcode
I'm trying to analyse my metal shaders for potential performance bottlenecks using the "Capture GPU Workload" function in Xcode (see screenshot).
When I select Frame or the device nothing happens. When I select the first command buffer then only in one out of ten attempt... | https://stackoverflow.com/questions/79835736/analyzing-performance-of-metal-shaders-in-xcode | swift, xcode, macos, gpu, metal | 1,764,671,165 |
se_79897820 | stackoverflow | MOBILE_DEVELOPMENT | How to update @State variable in my View? | How to update @State variable in my View?
struct ContentView: View {
@State var inputs1:Array<String> = ["*", "*", "*"]
@State var inputs2:Array<String> = ["*", "*", "*"]
var body: some View {
VStack(alignment: .center) {
let inputRow1 = createRow(inputs1[0], inputs1[1],... | https://stackoverflow.com/questions/79897820/how-to-update-state-variable-in-my-view | swift, swiftui, state | 1,772,195,976 |
se_75752673 | stackoverflow | MOBILE_DEVELOPMENT | Is there a way to change corner radius of UITableView in insetGrouped style? | Is there a way to change corner radius of UITableView in insetGrouped style?
Like This-
Has anyone been in a similar situation? | https://stackoverflow.com/questions/75752673/is-there-a-way-to-change-corner-radius-of-uitableview-in-insetgrouped-style | ios, swift, uitableview, swiftui, uikit | 1,678,947,124 |
se_46078058 | stackoverflow | MOBILE_DEVELOPMENT | Connect swift to sql server | Connect swift to sql server
Swift 3 / Xcode 8.3.3
I have an SQL server running on phpmyadmin and I would like to send an SQL request (like : SELECT * FROM database) directly from my Swift code. I did a lot of research but all of the answer use PHP.
In the end, I would like to transform this Java code into Swift:
tr... | https://stackoverflow.com/questions/46078058/connect-swift-to-sql-server | ios, swift | 1,504,708,622 |
se_79897341 | stackoverflow | MOBILE_DEVELOPMENT | How do I query in Fluent (in Vapor) for items with a nil value for an OptionalParent relation? | How do I query in Fluent (in Vapor) for items with a nil value for an OptionalParent relation?
Given Fluent's example of an OptionalParent relationship:
final class Planet: Model {
// Example of an optional parent relation.
@OptionalParent(key: "star_id")
var star: Star?
}
How do I query for planets with ... | https://stackoverflow.com/questions/79897341/how-do-i-query-in-fluent-in-vapor-for-items-with-a-nil-value-for-an-optionalpa | swift, vapor, vapor-fluent | 1,772,133,969 |
se_79889529 | stackoverflow | MOBILE_DEVELOPMENT | Swift 6 Concurrency: Call to actor-isolated instance method in a synchronous context | Swift 6 Concurrency: Call to actor-isolated instance method in a synchronous context
I am trying to access a function from an Actor and getting the below error.
Error: Call to actor-isolated instance method 'loadJson' in a synchronous actor-isolated context
public actor HandlerA {
public func functionA1() {
... | https://stackoverflow.com/questions/79889529/swift-6-concurrency-call-to-actor-isolated-instance-method-in-a-synchronous-con | swift, concurrency, swift6 | 1,771,115,136 |
se_79896563 | stackoverflow | MOBILE_DEVELOPMENT | Xcode find module for class in Swift Developer Documentation | Xcode find module for class in Swift Developer Documentation
In the Xcode Developer Documentation, the type "FilePath" is listed under
Fundamentals > Foundation > Numbers, Data and Basic Values > URL > FileSystem
However, to use it, I need to import System . The Developer Documentation does not seem to indicate that t... | https://stackoverflow.com/questions/79896563/xcode-find-module-for-class-in-swift-developer-documentation | swift, xcode, documentation | 1,772,058,621 |
se_78323147 | stackoverflow | MOBILE_DEVELOPMENT | SwiftUI modify image frame | SwiftUI modify image frame
I have an image that I would like to always use the maximum available width. However the image should have a max height of 500 and should only utilize the height if it will fill it.
Currently wide images don't fill the full height but the images frame is still 500 and hence why the text view... | https://stackoverflow.com/questions/78323147/swiftui-modify-image-frame | swift, swiftui | 1,713,082,564 |
se_79896289 | stackoverflow | MOBILE_DEVELOPMENT | How can I have a ScrollView scroll its contents to align with another View's bottom edge? | How can I have a ScrollView scroll its contents to align with another View's bottom edge?
var body: some View {
ZStack(alignment: .top) {
dateAndTime
ScrollView {
VStack {
storyContent
}
}
}
How can I get the ... | https://stackoverflow.com/questions/79896289/how-can-i-have-a-scrollview-scroll-its-contents-to-align-with-another-views-bot | ios, swift, swiftui, swiftui-scrollview | 1,772,029,578 |
se_70076431 | stackoverflow | MOBILE_DEVELOPMENT | Void withCheckedThrowingContinuation Generic parameter 'T' could not be inferred | Void withCheckedThrowingContinuation Generic parameter 'T' could not be inferred
I'm unable to get withCheckedThrowingContinuation to compile when there’s no return type. For example:
public
func
write(toDevice inDeviceID: Int, atAddress inAddr: Int, value inVal: Float)
async
throws... | https://stackoverflow.com/questions/70076431/void-withcheckedthrowingcontinuation-generic-parameter-t-could-not-be-inferred | swift | 1,637,649,859 |
se_79896316 | stackoverflow | MOBILE_DEVELOPMENT | SwiftUI Button does not respect frame height limit and reaches into SafeArea | SwiftUI Button does not respect frame height limit and reaches into SafeArea
This is the stripped down version of a view I have in my project:
struct MyView: View {
var body: some View {
let buttonHeigth = CGFloat(40)
ZStack(alignment: .top) {
... | https://stackoverflow.com/questions/79896316/swiftui-button-does-not-respect-frame-height-limit-and-reaches-into-safearea | swift, swiftui, button, safearea | 1,772,031,917 |
se_79894980 | stackoverflow | MOBILE_DEVELOPMENT | How to call a function from a Button in Swift | How to call a function from a Button in Swift
I am VERY new to Swift! Pleas have mercy on my basic question.
I'm trying programmatically set up a button. I call a function like so:
override func viewDidLoad() {
super.viewDidLoad()
var yCord1 = 100
var yCord2 = 200
setUpButton("YES", y... | https://stackoverflow.com/questions/79894980/how-to-call-a-function-from-a-button-in-swift | ios, swift, uikit, uibutton | 1,771,882,527 |
se_79894707 | stackoverflow | MOBILE_DEVELOPMENT | Send notification when app is force closed | Send notification when app is force closed
Apps that require you to keep it running in the background like Whoop, Tesla etc send a notification when you force close it.
How do they do this ?
As far as I know there is no way to detect reliably when you app is about to be killed.
appWillTerminate does not trigger if the... | https://stackoverflow.com/questions/79894707/send-notification-when-app-is-force-closed | ios, swift, unusernotificationcenter, ios-background-mode, ios-lifecycle | 1,771,859,355 |
se_79894698 | stackoverflow | MOBILE_DEVELOPMENT | How to get iOS LiveActivity to change status to timer completed | How to get iOS LiveActivity to change status to timer completed
I'm using the timerInterval for the live activity however when the timer expires it doesn't change its status to completed state and I couldn't find a listener to call that
Text(timerInterval: Date()...context.state.endDate, countsDown: true, showsHours: ... | https://stackoverflow.com/questions/79894698/how-to-get-ios-liveactivity-to-change-status-to-timer-completed | ios, swift, swiftui, timer, widgetliveactivity | 1,771,858,612 |
se_78904658 | stackoverflow | MOBILE_DEVELOPMENT | Navigation bar SwiftUI toolbar background | Navigation bar SwiftUI toolbar background
I set up my nav bar like this:
.navigationTitle(selectedTab == .users ? "Working with GET request" : "Working with POST request")
.navigationBarTitleDisplayMode(.inline)
.toolbarBackground(UIConstraints.primary, for: .navigationBar)
.toolbarBack... | https://stackoverflow.com/questions/78904658/navigation-bar-swiftui-toolbar-background | ios, swift, swiftui, navigationbar | 1,724,396,275 |
se_69521968 | stackoverflow | MOBILE_DEVELOPMENT | Why calling `DispatchQueue.main.sync` asynchronously from concurrent queue succeeds but synchronously fails? | Why calling `DispatchQueue.main.sync` asynchronously from concurrent queue succeeds but synchronously fails?
Here I create concurrent queue with .background priority:
let background = DispatchQueue(label: "backgroundQueue",
qos: .background,
attributes: [],... | https://stackoverflow.com/questions/69521968/why-calling-dispatchqueue-main-sync-asynchronously-from-concurrent-queue-succe | ios, swift, multithreading, concurrency | 1,633,934,264 |
se_72786622 | stackoverflow | MOBILE_DEVELOPMENT | App migrated to UIKit lifecycle doesn't call SceneDelegate | App migrated to UIKit lifecycle doesn't call SceneDelegate
We migrated our app from the SwiftUI to the UIKit lifecycle and app containment, creating a standard AppDelegate, SceneDelegate, and updating the required info.plist properties. I didn't follow this tutorial, but if you're unfamiliar, this is exactly what ... | https://stackoverflow.com/questions/72786622/app-migrated-to-uikit-lifecycle-doesnt-call-scenedelegate | ios, swift, swiftui, uikit | 1,656,420,035 |
se_79657270 | stackoverflow | MOBILE_DEVELOPMENT | How to preload external RevenueCat paywall (UIKit) to avoid image loading during first display? | How to preload external RevenueCat paywall (UIKit) to avoid image loading during first display?
I'm adding RevenueCat to my iOS app that’s built with UIKit, and I’m using one of their external paywalls made with the web paywall builder.
The first time the paywall shows up, the images take a second to load in front of ... | https://stackoverflow.com/questions/79657270/how-to-preload-external-revenuecat-paywall-uikit-to-avoid-image-loading-during | swift, uikit, revenuecat | 1,749,325,244 |
se_30992191 | stackoverflow | MOBILE_DEVELOPMENT | Factorials in Swift | Factorials in Swift
I need a good factorial function. The one I have written here works entirely, except when n gets far too large. This is for a calculator app, and I can return 0 / 0 for values that cannot be factorialed because I have an error checker that will declare that as impossible. However performing the fun... | https://stackoverflow.com/questions/30992191/factorials-in-swift | swift, factorial | 1,435,020,913 |
se_78288519 | stackoverflow | MOBILE_DEVELOPMENT | Unable to get SSL and HTTP Protocol Types Using Alamofire | Unable to get SSL and HTTP Protocol Types Using Alamofire
I'm using Alamofire in my project for networking. I need to extract data about the protocols used on the device from the requests, specifically the SSL encryption protocol type and the HTTP protocol type.
I'm utilizing Alamofire's API, which internally works wi... | https://stackoverflow.com/questions/78288519/unable-to-get-ssl-and-http-protocol-types-using-alamofire | ios, swift, network-programming, alamofire, urlsession | 1,712,507,251 |
se_79639468 | stackoverflow | MOBILE_DEVELOPMENT | Nonisolated error for Alamofire library in Swift 6 | Nonisolated error for Alamofire library in Swift 6
I've been asked to refactor the entire code of this project to work on Swift 6
I'm almost done with the refactoring except for this last APIRouter class which conforms to Alamofire's URLRequestConvertible protocol.
I thought that by simply marking APIRouter as @MainAc... | https://stackoverflow.com/questions/79639468/nonisolated-error-for-alamofire-library-in-swift-6 | swift, alamofire, swift6 | 1,748,286,699 |
se_79894568 | stackoverflow | MOBILE_DEVELOPMENT | Liquid Glass menu on UIButton shows a disappearing bubble | Liquid Glass menu on UIButton shows a disappearing bubble
I am currently developing an app that introduced a weird effect when built on iOS 26 with Liquid Glass. I simply have a square UIButton, that supposedly shows a menu when tapped. When done with all the liquid glass effects, a huge bubble appears below the menu,... | https://stackoverflow.com/questions/79894568/liquid-glass-menu-on-uibutton-shows-a-disappearing-bubble | ios, swift, uibutton, liquid-glass | 1,771,847,445 |
se_79894787 | stackoverflow | MOBILE_DEVELOPMENT | Stack views under a another centered view | Stack views under a another centered view
In SwiftUI, how can you stack views below another view that is centered vertically?
In this example, the blue view is in a ZStack to be centered automatically. How can you add the text vertical stack (title + subtitle) to the ZStack to be under the centered blue view?
ZSt... | https://stackoverflow.com/questions/79894787/stack-views-under-a-another-centered-view | ios, swift | 1,771,864,527 |
se_79891799 | stackoverflow | MOBILE_DEVELOPMENT | CloudKit records not deleted when removed from iOS app | CloudKit records not deleted when removed from iOS app
For an unknown reason, when I delete a record in my app, the CloudKit record does not delete. So the next time the app runs, the "deleted" records come back.
I add the records as follows:
func addReadingListBook (book: NYTBook, list: ReadingList) {
//set it
... | https://stackoverflow.com/questions/79891799/cloudkit-records-not-deleted-when-removed-from-ios-app | ios, swift, cloudkit | 1,771,443,261 |
se_77658217 | stackoverflow | MOBILE_DEVELOPMENT | Modifications to the layout engine must not be performed from a background thread on iOS 17 and above | Modifications to the layout engine must not be performed from a background thread on iOS 17 and above
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.... | https://stackoverflow.com/questions/77658217/modifications-to-the-layout-engine-must-not-be-performed-from-a-background-threa | ios, swift, iphone, xcode, autolayout | 1,702,536,151 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.