xcode

.sink is not returning the promise values from a Future Publisher

最后都变了- 提交于 2020-11-29 21:29:50
问题 I have this code in lrvViewModel.swift func getVerificationID (phoneNumber: String) -> Future<String?, Error> { return Future<String?, Error> { promise in PhoneAuthProvider.provider().verifyPhoneNumber(phoneNumber, uiDelegate: nil) { (verificationID, error) in if let e = error { promise(.failure(e)) return } print("verification worked") self.defaults.set(verificationID, forKey: "authVerificationID") return promise(.success(verificationID)) } } } and then i call and subscribe to the Publisher

.sink is not returning the promise values from a Future Publisher

岁酱吖の 提交于 2020-11-29 21:27:05
问题 I have this code in lrvViewModel.swift func getVerificationID (phoneNumber: String) -> Future<String?, Error> { return Future<String?, Error> { promise in PhoneAuthProvider.provider().verifyPhoneNumber(phoneNumber, uiDelegate: nil) { (verificationID, error) in if let e = error { promise(.failure(e)) return } print("verification worked") self.defaults.set(verificationID, forKey: "authVerificationID") return promise(.success(verificationID)) } } } and then i call and subscribe to the Publisher

SwiftUI Generic Pull to refresh view

北战南征 提交于 2020-11-29 10:58:32
问题 I have this CustomScrollView which wraps my HomeView and if you pull down it fetches new data. It works fine but the thing is that I want to reuse this in multiple views and I do not want to create a copy of this for each of my views. I have tried to do this var rootView: View but it throws an error saying View is not convertible to HomeView . So there are two thing witch should be generic. HomeView() and HomeViewModel . Any idea how to achieve that? struct CustomScrollView :

SwiftUI Generic Pull to refresh view

送分小仙女□ 提交于 2020-11-29 10:57:53
问题 I have this CustomScrollView which wraps my HomeView and if you pull down it fetches new data. It works fine but the thing is that I want to reuse this in multiple views and I do not want to create a copy of this for each of my views. I have tried to do this var rootView: View but it throws an error saying View is not convertible to HomeView . So there are two thing witch should be generic. HomeView() and HomeViewModel . Any idea how to achieve that? struct CustomScrollView :

How to change the segue type of the storyboards

旧巷老猫 提交于 2020-11-29 10:36:25
问题 I've got this problem. I want the view controller to change when the player presses a specific button. So I added a new "view controller" in the main storyboard, I customised it and then, holding the right button of the mouse, I dragged the button on the new view controller. It appeared a little menu with different items: show show detail present modally present as a popover custom I've tried all of them, nothing changed (except for the last one: the app crashes). The new view controller is

NSStatusItem Button Title to the Right of the Image

試著忘記壹切 提交于 2020-11-29 08:34:11
问题 I want an NSStatusItem ’s button’s title to appear to the right of its image. Here’s an example, this is the OS X VPN menubar app: If I set either the title or image for my NSStatusItem ’s button, they render correctly. However if I set both , they get superimposed and are horizontally center-aligned. Is there a way to achieve the side-by-side placement without creating a custom UIView ? 回答1: This has to do with a change in Yosemite, which deprecated setTitle: and setImage: on NSStatusItem .

SwiftUI - nested list

╄→гoц情女王★ 提交于 2020-11-29 08:17:30
问题 I'm trying to create a nested hierarchical list, so that for each task I can have subtasks like in iOS reminders app: First attempt was to embed another list inside a list cell. import SwiftUI struct SwiftUIView: View { var body: some View { List { List { Text("Hello, World!") } } } } struct SwiftUIView_Previews: PreviewProvider { static var previews: some View { SwiftUIView() } But, didn't work out... Anyone can help? cheers 回答1: Why do you think it should be List in List... Such visual

SwiftUI - nested list

社会主义新天地 提交于 2020-11-29 08:14:45
问题 I'm trying to create a nested hierarchical list, so that for each task I can have subtasks like in iOS reminders app: First attempt was to embed another list inside a list cell. import SwiftUI struct SwiftUIView: View { var body: some View { List { List { Text("Hello, World!") } } } } struct SwiftUIView_Previews: PreviewProvider { static var previews: some View { SwiftUIView() } But, didn't work out... Anyone can help? cheers 回答1: Why do you think it should be List in List... Such visual

SwiftUI - nested list

偶尔善良 提交于 2020-11-29 08:14:32
问题 I'm trying to create a nested hierarchical list, so that for each task I can have subtasks like in iOS reminders app: First attempt was to embed another list inside a list cell. import SwiftUI struct SwiftUIView: View { var body: some View { List { List { Text("Hello, World!") } } } } struct SwiftUIView_Previews: PreviewProvider { static var previews: some View { SwiftUIView() } But, didn't work out... Anyone can help? cheers 回答1: Why do you think it should be List in List... Such visual

Xcode UI Test environment variables not being passed from Scheme

a 夏天 提交于 2020-11-29 04:23:58
问题 In Xcode 9.2, for my iOS app, I have a Scheme for running my UI Test suite. In this scheme, under the "Test" tab, I have both environment variables and arguments defined. When my tests run, these variables aren't available to my app code. However, I am able to programmatically set both the arguments and the launchEnvironment in the test code, and those ones are available to the app while it's running under test. I also have environment variables and arguments set in the "Run" tab, and those