Category "swift"

UIHostingController and navigationController

Default swift project with view controller embedded in navigationController and pushing to next UIHostingController. How to call navigationController?.popViewC

iOS14, WKWebView cannot open links with _blank target

I have WKWebView that I want to use to browse a certain web site. However some links with target="_blank" are not always opening. From run to run, I get differe

-1103 Error Domain=NSURLErrorDomain Code=-1103 "resource exceeds maximum size" iOS 13

We are facing the following networking error when the response is somehow large(14kb) on iOS 13. [-1103] Error Domain=NSURLErrorDomain Code=-1103 "resource ex

SwiftUI: Translucent background for fullScreenCover

So technically I want to show a loading screen view. I'm using fullScreenCover. struct ContentView: View { @State private var isLoading = false

Swift 3: UITextView - Dynanmic height - Programmatically

I have a keyboardContainer class (Subclass of UIView / created programmatically so no storyboard) including a UITextView for the user to type messages in. It is

SceneKit how to move a character on terrain with different height

I am working on a scene with a character and a platform with a stairs. Character must move up and down of the stairs and jump from the platform: I move charac

How to move NSImageView inside NSView in Cocoa?

In my Mac OS app I need a functionality to be able to move NSImageView around inside an NSView after mouseDown event (triggered by user) happen in this NSImageV

ToolbarItemGroup in .toolbar {} doesn't work in a Sheet

I'm using SwiftUI 3.0, Swift 5.5 and Xcode 13.2, tested on iOS 15.3 iPhone device, and iOS 15.2 iPhone simulator. I have tested the following. This is a view, w

SwiftUI .onTapGesture always higher priority than .swipeActions

How do I make my the code in .swipeActions be called instead of the one in .onTapGesture? I have a SwiftUI view like follows: struct ContentView: View {

swift "completion: @escaping" in kotlin language. How to use callback in kotlin?

I am looking for a way of completion block for my kotlin code. In Swift i have my function: func fetchRegister(with request: RegisterRequest, completion: @es

Xcode 11 beta swift ui preview not showing

Just playing with Swift UI basic app and the preview canvas is not showing even though I'm in canvas mode. App runs, and I have this little snippet what am I mi

How to change "Cancel" button text in modal sheet view in SwiftUI on watchOS 7?

I have 2 simple views: import SwiftUI struct ContentView: View { @State private var showingModalView = false var body: some View { Button(

UIApplication.shared.delegate equivalent for SceneDelegate xcode11?

I have defined a let property within my SceneDelegate. I would like some of the ViewControllers to be able to access that within the scene. In UIKit I could ac

Custom back button for NavigationView's navigation bar in SwiftUI

I want to add a custom navigation button that will look somewhat like this: Now, I've written a custom BackButton view for this. When applying that view as l

iOS SwiftUI: pop or dismiss view programmatically

I couldn't find any reference about any ways to make a pop or a dismiss programmatically of my presented view with SwiftUI. Seems to me that the only way is to

What is the difference between ObjectBinding and EnvironmentObject?

What is the purpose of @EnvironmentObject when we have @Binding property wrapper ? I am having trouble figuring out why @EnvironmentObject is needed. I took a l

Pull down to refresh data in SwiftUI

i have used simple listing of data using List. I would like to add pull down to refresh functionality but i am not sure which is the best possible approach. Pu

when i scroll down viewController shaking

Hello guys ,I have problem when i try scrolling down my viewcontroller shaking ,i couldn't find error.In other view controller haven't errors like this... How

Cleanest way to wrap array index?

Say I have an array of 5 Ints. What would be the most efficient way to wrap the index of the array if the index were incremented or decremented (for example) th

Issues while switching cameras during recording with AVFoundation

I am building a camera application similar to snapchat, and I need to be able to switch cameras while recording. I am able to switch cameras while NOT recording