Closed VineFiner closed 2 years ago
Hello, I'm not familiar with rx, can you elaborate on what you mean by distinguishing namespaces? Thanks!
import Foundation
struct MyNameSpace<Base> {
private let base: Base
init(base: Base) {
self.base = base
}
}
extension MyNameSpace {
func hello() {
print("hello")
}
}
protocol NameSpcaceWrappable {
associatedtype T
//
var rx: T { get }
//
static var rx: T.Type { get }
}
//
extension NameSpcaceWrappable {
var rx: MyNameSpace<Self> {
return MyNameSpace<Self>(base: self)
}
static var rx: MyNameSpace<Self>.Type {
return MyNameSpace<Self>.self
}
}
extension String: NameSpcaceWrappable {
}
let space = String()
space.rx.hello()
hmm, maybe an example related to this project would be better, I'm still trying to know what you are proposing here. Wrap a UIColor/UIImage?
hmm, maybe an example related to this project would be better, I'm still trying to know what you are proposing here. Wrap a UIColor/UIImage?
Yes, I found a binary library.
https://github.com/Elenionl/EasyDarkMode
Is it better for swift?
import EasyDarkMode
imageView.image = UIImage.dm.image(name: "check_light", dark: "check_dark")
Closing, we do not intend to make interface changes in the future. Objective-C compatibility has been added a few commits ago.
Sorry, this may not be a wrong.
r.swift uses
.rx
to distinguish namespacesWhy didn’t you use the same method, for compatibility with
Objective-C
?