Category "swift"

Suppress warnings from dependencies with Swift Package Manager

Assuming I have a Package.swift like this below, and SomePackage from the dependencies produces warnings during swift build. // swift-tools-version:4.0 import

How to use a SwiftUI view in place of table view cell

How can I use a SwiftUI view struct in place of a traditional cell and xib in a UITableViewController? import UIKit import SwiftUI class MasterViewController:

Determine on iPhone if user has enabled AutoFill Passwords

Hyperlink is shown at last for attached image, want to show highlighted option value from device setting section to my app . How to get current value of AutoFi

safeAreaInsets in UIView is 0 on an iPhone X

I am updating my app to adapt it for iPhone X. All views work fine by now except one. I have a view controller that presents a custom UIView that covers the who

Swift 4 - How to return a count of duplicate values from an array? [duplicate]

I have an array with multiple values (Doubles), many of which are duplicates. I'd like to return or print a list of all unique values, along

fixing Memory Issue in Swift

I'm having a memory issue while pushing/segueing to certain UIViewControllers [ChallengePrivacySettingViewC]. All of component of the ChallengePrivacySettingV

Swift - AVFoundation capture image orientation

I have a custom camera which takes photo in portrait mode. My issue is that if i try to take a photo in landscape and save it then the picture is still saved i

How to convert Any? to Data in swift [duplicate]

I need to convert from type Any? to Data. something like this func getItem(item:Any?) { let data = convertToData(item) }

How to hide dash between the bars in waterfall charts of Highcharts in iOS

Basically I want to hide dash between the bars from waterfall chart.I am using highcharts iOS wrapper.I can only change type of dash but there is no option to h

Initializer requirement 'init(json:)' can only be satisfied by a `required` initializer in the definition of non-final class 'UIColor'

I'm trying to write an extension to satisfy a protocol in an extension like so: extension UIColor: JSONRepresentable { convenience init?(json: Any) {

How to display an int without commas?

I have a list of Text views that include a year saved as an int. I'm displaying it in an interpolated string: Text("\($0.property) \($0.year) \($0.etc)") The p

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 {