Category "swift"

XCUITest ProgressView identifier hardcoded to "In progress" when within a Button

When creating a ProgressView and using .accessibilityIdentifier or a standard label, UI tests are able identify it. The view: ProgressView().accessibilityIdenti

How to view PDF from Firebase Storage - SwiftUI PDFVIEW

I am having some issues trying to display a PDF which is stored in Firebase Storage in my SwiftUI app. I have successfully done the following; Uploaded a PDF fi

Read and write permission for user selected folder in Mac OS app?

I am developing MAC OS app which have functionality to create file on the behalf of your. First user select folder for storing file (One time at start of app) a

Can I use MVVM without data binding?

I am trying to use MVVM. Upon reading some blogs on MVVM, I found them using data binding techniques like Rx, KVO, Boxing etc. Following are my classes for vali

Why is Swift compiler complaining about circular reference when I comment out seemingly unrelated code?

Creating a brand new macOS Command Line Tool project in Xcode Version 13.3 (13E113), and replacing the contents of main.swift with the following code: import Fo

usleep in Swifter degrades overtime

I have the following server: import SwiftUI import Swifter @main struct MacInputServer: App { let server: HttpServer; var body: some Scene { W

Swift convert unix time to date and time gives incorrect year

I am getting time string from server but when I convert it to local time its giving incorrect year like 52635 My code is- if let dateVal = (model.insert_date){

SwiftUI - Animations triggered inside a View that's in a list doesn't animate the list as well

I have a List that's displaying two Views of the same type. When you tap on one of the views, they change their height with an animation. However, the List tho

How to hide header and footer in WKWebView using Js and ios-14

How to hide header and footer in WKWebView in swift in IOS 14 I am using below code for loadiing thr website inside webview. webview.load(URLRequest.init(url:

How to get the iPhone's screen width in SwiftUI?

I want to resize an Image frame to be a square that takes the same width of the iPhone's screen and consequently the same value (screen width) for height. The

Allow PieChartView to hide labels for tiny slices in Swift

I'm making a chart by using chart iOS framework. but the value will overlay when the slice is tiny. How can I hide it? This question is similar to this GitHub l

Inject a StateObject into SwiftUI View

Can @StateObject be injected using Resolver? I have the following: struct FooView: View { @StateObject private var viewModel: FooViewModel some code }

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) }