Category "swift"

Dismiss button in SwiftUI modal called from UIKit

I have got a SwiftUI modal view which I am calling from main UIKit view. I want to add a dismiss button to my modal view. As I can tell, there is no @State vari

Setting Autolayout Constraints on UIButton in Swift

I'm still trying to get my head around Swift Autolayouts here in XCode 6.3. I have set up a View Controller that I stuck a couple of labels on in Interface Buil

How do I atomically increment a variable in Swift?

I want to be able to increment a counter atomically and I can't find any reference on how to do it. Adding more information based on comments: Are you using GCD

Is it possible to detect if any other certain app is Currently running or not in iOS?

Let say If I want to check if the facebook or any other application is currently running on device ?

How do I refactor my code to call AppDelegate on the main thread?

I recently started migrating my project from Swift3/Xcode8 to Swift4/Xcode9. My app crashes at runtime because the main thread sanitizer allows access to UIAppl

RealityKit as a framework to build 3D nonAR apps

RealityKit has an option for .nonAR camera, but lacks fundamental options to build 3D nonAR apps, like camera control (.allowsCameraComtrol). Is it viable to us

In iOS (swift) app, registration of a second Firebase app can't receive remote notifications

I'm having two Firebase projects (on se same account, but could be two different accounts) and each project have an iOS app registered with the same bundle ID (

How to count occurrences of an element in a Swift array?

I've seen a few examples of this but all of those seem to rely on knowing which element you want to count the occurrences of. My array is generated dynamically

Xcode won't pause at this breakpoint because it has not been resolved

Shortly after updating to Xcode 13.2.1 I started seeing some weird behaviour of breakpoints. When I run an app (in a simulator) some of my breakpoints change th

Invalid Bundle - One or more dynamic libraries that are referenced by your app are not present in the dylib search path | Xcode 13.3

I am submitting a .xcarchive to the App Store via Xcode 13.3 but I keep on getting the following email error: ITMS-90562: Invalid Bundle - One or more dynamic l

How to adjust brightness contrast saturation in swift with a UISlider

I have been looking for the past couple of days on how to implement a filter to a UIImage by manually manipulating the brightness, contrast, highlight, shadows,

Horizontal scroll UICollectionView has additional line spacing?

I'm trying to use UICollectionView to make a table, when I set it to vertical scroll, everything is working great. But when I set it to horizontal scroll, it a

How to Remove UIMenuController Default Items In Swift

I'm trying to remove the items Look Up & Share... from the UIMenuController. How would I specifically remove the two and keep my custom one. Here is what I'

Best Way to Update/Edit an Array Element in SwiftUI

I have an array of identifiable Training elements. Each Training element only has two properties, name and isRequired. What is the most straight-forward (Swif

how to overload an assignment operator in swift

I would like to override the '=' operator for a CGFloat like the follow try : func = (inout left: CGFloat, right: Float) { left=CGFloat(right) } So I cou

WKWebView not showing Navigation Bar

I have a view in SwiftUI that shows a WKWebView which is passed to the main ContentView using the UIViewControllerRepresentable class, implemented following the

How to return data from WKWebView to JavaScript

I am developing a hybrid Android and iOS app using WebViews. However, I am struggling to return data from iOS app back to my Javascript. Below is how I setup t

Stereo ARSCNview to make VR and AR mix

I want to make a mix of virtual reality and augmented reality. The goal is I have a stereo camera (for each eyes). I tried to put two ARSCNView in a viewCotnro

The app delegate must implement the window property if it wants to use a main storyboard file swift

I have just developed an app, but when running in the simulator the debugger console says: The app delegate must implement the window property if it wants t

Check for duplicate characters in string using for-loops in swift

I did this using while loops but I'm wondering if there's a way to do this with for loops. I'm trying to write this clean so I can write it on a whiteboard for