swift5

Retrieve multiple filters in Firebase [Swift]

早过忘川 提交于 2021-02-05 11:17:36
问题 Is there a way to quickly pull all the userId that has the same username? For example, if userId_002 also had the username "sean", can I quickly retrieve ["userId_001","userId_002"]? I appreciate any help! I'm trying this but doesn't work: let results = Database.database().reference().child("usernames").queryOrdered(byChild: "username").queryEqual(toValue: "sean") results.observeSingleEvent(of: .value, with: { (snapshot) in for child in snapshot.children { let value = child as! DataSnapshot

SwiftUI @FetchRequest crashes the app and returns error

本小妞迷上赌 提交于 2021-02-05 07:51:29
问题 I am trying to use core data within my mac app with SwiftUI using Xcode 11. I have checked "Using Core Data" when creating the project. I also have created the entity (called VisitedCases) and used editor to create NSManagedObject Subclass files. I also have set the Codegen to Manual/none. Here is the code in the generated NSManagedObject files: VisitedCases+CoreDataProperties.swift extension VisitedCases { @nonobjc public class func fetchRequest() -> NSFetchRequest<VisitedCases> { return

Right way to implement Firebase Auth with State listener Swift 5

戏子无情 提交于 2021-01-29 14:54:37
问题 very new to ios development and Firebase. I have implemented a standard run-of-the-mill ui flow where the app opens to a splash-screen, where it's checked whether user is signed in or not and depending on the state the user is redirected to the login screen or home screen. I'm trying to get a user id from auth listener, and some of my getUserId calls from the userManager are happening before the firebase auth gives a non-nil user id, and the user always ends up going to the registration

Using Swift 5 Libraries in a Swift 4 Project

本小妞迷上赌 提交于 2021-01-29 13:09:30
问题 I am using Swift 4 version in my current project. However, the Swift version of Cocoapods library is 5. I can't downgrade the library because the latest version of the library has the features I want. In addition, there are a lot of difficulties in raising the version of the project immediately. I'm trying to modify the code in a library after installing the latest version of the library. But the workload is very heavy. Is there a good way?? Help me.. 回答1: Try setting the pod swift version

Converting from UIExtendedSRGBColorSpace to Hex

别来无恙 提交于 2021-01-29 09:17:37
问题 I'm using a framework that outputs colour in the UIExtendedSRGBColorSpace format. I need to display a six character hex value for this output colour to the user and for a backend application that only accepts six-character hex codes. I've tried numerous conversion methods but they all seem to result in odd hex values. For example, getting an output UIExtendedSRGBColorSpace 0.276088 -0.0525 1.05 1 and using an extension like this (which i've used successfully many times before) results in

<code>01</code> <message>Invalid request</message> in telr Payment gateway in iOS swift5

笑着哭i 提交于 2021-01-29 06:38:18
问题 I am integrating Telr Payment in my App. After sending request to Telr (https://secure.innovatepayments.com/gateway/mobile.xml) it is returning start url for web view and everything is working fine , as per in this link then, I have given a second request, to complete the transaction, i.e. https://secure.innovatepayments.com/gateway/mobile_complete.xml After navigating to the url of webview, I am calling this mobile_complete.xml api, by passing the following parameters. (Test mode) <?xml

<code>01</code> <message>Invalid request</message> in telr Payment gateway in iOS swift5

杀马特。学长 韩版系。学妹 提交于 2021-01-29 06:22:33
问题 I am integrating Telr Payment in my App. After sending request to Telr (https://secure.innovatepayments.com/gateway/mobile.xml) it is returning start url for web view and everything is working fine , as per in this link then, I have given a second request, to complete the transaction, i.e. https://secure.innovatepayments.com/gateway/mobile_complete.xml After navigating to the url of webview, I am calling this mobile_complete.xml api, by passing the following parameters. (Test mode) <?xml

updatedTransactions(transactionState == .restored) vs paymentQueueRestoreCompletedTransactionsFinished

怎甘沉沦 提交于 2021-01-29 03:19:19
问题 As the title describes, what is the actual different? If I have this: func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) { for transaction in transactions { if transaction.transactionState == .purchased { } else if transaction.transactionState == .failed { } else if transaction.transactionState == .restored { // <- This one } } Do I still need to use this (if yes, what code to use here, and what code in transactionState == .restored ?: func

Detect tap for UILabel with Autoshrink to minimum font size enabled

折月煮酒 提交于 2021-01-29 00:29:42
问题 I am using the following UITapGestureRecognizer that I modified so others could copy and paste to see the same output as me. extension UITapGestureRecognizer { func didTapAttributedTextInLabel(label: UILabel, inRange targetRange: NSRange) -> Bool { // Create instances of NSLayoutManager, NSTextContainer and NSTextStorage let layoutManager = NSLayoutManager() let textContainer = NSTextContainer(size: CGSize.zero) //let mutableAttribString = NSMutableAttributedString(attributedString: label

Detect tap for UILabel with Autoshrink to minimum font size enabled

隐身守侯 提交于 2021-01-29 00:28:12
问题 I am using the following UITapGestureRecognizer that I modified so others could copy and paste to see the same output as me. extension UITapGestureRecognizer { func didTapAttributedTextInLabel(label: UILabel, inRange targetRange: NSRange) -> Bool { // Create instances of NSLayoutManager, NSTextContainer and NSTextStorage let layoutManager = NSLayoutManager() let textContainer = NSTextContainer(size: CGSize.zero) //let mutableAttribString = NSMutableAttributedString(attributedString: label