Created
May 1, 2020 04:05
-
-
Save leopic/04b62ab1f6f4edbf17777237cb0b4967 to your computer and use it in GitHub Desktop.
Having fun with Swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit | |
import Combine | |
var texto = CurrentValueSubject<String, Never>("hola buen chico") | |
let sub = texto | |
.map { $0.boyeSpeakify } | |
.handleEvents(receiveOutput: { UIPasteboard.general.string = $0 }) | |
.sink { print($0) } | |
DispatchQueue.main.asyncAfter(deadline: .now() + 2) { | |
texto.send("who's a good boye? ๐ถ ๐ ๐ฉ ๐พ ๐ญ") | |
} | |
DispatchQueue.main.asyncAfter(deadline: .now() + 4) { | |
texto.send("ยฟy con emojis de colores? ๐๐ฝ") | |
} | |
extension String { | |
var boyeSpeakify: String { | |
return self.map { "\($0) " }.joined() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment