Post

Replies

Boosts

Views

Activity

Reply to Emoji in string in UIImage(named: string) does not work
When I do the call with a string containing only lettere, like yours UIImage(named: "Photos") it works.Thats the equivalent of my working example UIImage(named: "11j".It is when the call is made with a string that contains un emoji. UIImage(named: "J♥") that it does not work.The result of the if let statement returns nil.The name of the image in the Asset folder is "J♥".So it is not a matter of a name that is not copied correctly.
Jan ’20
Reply to CombineLatest unsolved
Thank you for your answer/solution.As functional programming is new to me I'm having some difficulty, but your answer showed me some of the logic of the construction.But it also leads me to another question. In the below example (same origin as the previous one) the computation concerns a touple of strings.I'm stuck on the optional part.The tuple is optional.And the validatedPassword is optional.The compiler complains on the guard line that binding must be optional, not String(I assume let pwd = ...).Trying to change password or validatedPassword the compiler rightly complains that that the Publisher is defined as <(String, String?..>.So there is a missing step before the map, and one after ?Is there a recommended way of building the chain of modifiers?I'm not looking as much for a precise solution for this problem, as for a general approach to this kind of problems.And documentation seem to be scare.Do you have any recommendation that might guide me in the right direction ?RegardsLarsPS upgraded to no changeXcode : 11.5 beta1OS : 10.15.5 beta2 Machine : MacMini 201Memory : 32 GO var validatedCredentials: AnyPublisher<(String, String)?, Never> { return Publishers.CombineLatest(validatedUserName, validatedPassword) .map{ (username, password)->(String, String)? in guard let uname = username , let pwd = password else {return nil } return(uname, pwd) } .eraseToAnyPublisher() }
Apr ’20
Reply to CombineLatest unsolved
My apologies, your answer worked very well with the validatedUser variable, but my problem is now with the validatedCredentials.Would you have any idea of where the proble is?ThanksLarsXcode : 11.5 beta1OS : 10.15.5 beta2 Machine : MacMini 201Memory : 32 GO var validatedCredentials: AnyPublisher<(String, String)?, Never> { return Publishers.CombineLatest(validatedUserName, validatedPassword) .map{ (username, password)->(String, String)? in guard let uname = username , let pwd = password else {return nil } return(uname, pwd) } .eraseToAnyPublisher() }
May ’20
Reply to CombineLatest unsolved
I apologize I was wrong with my paste below the good one.It gives me the error message on the guard statement"Initializer for conditional binding must have Optional type, not 'Published<String>.Publisher.Output' (aka 'String')"RegardsLarsXcode : 11.5 beta1OS : 10.15.5 beta2 Machine : MacMini 201Memory : 32 GO var validatedCredentials: AnyPublisher<(String, String)?, Never> { return Publishers.CombineLatest($userName, $password).map { username, password in guard let uname = username, let pwd = password else { return nil } return (uname, pwd) } .eraseToAnyPublisher() }
May ’20