Skip to content

Instantly share code, notes, and snippets.

@leopic
Created May 1, 2020 04:05
Show Gist options
  • Save leopic/04b62ab1f6f4edbf17777237cb0b4967 to your computer and use it in GitHub Desktop.
Save leopic/04b62ab1f6f4edbf17777237cb0b4967 to your computer and use it in GitHub Desktop.
Having fun with Swift
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