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 RxCocoa | |
import RxSwift | |
import UIKit | |
final class FilledTextFieldDelegateProxy: | |
DelegateProxy<FilledTextField, FilledTextFieldDelegate>, | |
FilledTextFieldDelegate, | |
DelegateProxyType { | |
init(filledTextField: FilledTextField) { |
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
extension Reactive where Base: FilledTextField { | |
var delegate: DelegateProxy<FilledTextField, FiledTextFieldDelegate> { | |
return FilledTextFieldDelegateProxy.proxy(for: base) | |
} | |
var textDidChange: ControlProperty<String?> { | |
let source = delegate.methodInvoked(#selector(FilledTextFieldDelegate.filledTextField(_:textFieldTextDidChange:))) | |
.map { params -> String? in | |
let text = try castOrThrow(String.self, params[1]) | |
return text |
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 RxCocoa | |
import RxSwift | |
import UIKit | |
final class FilledTextFieldDelegateProxy: | |
DelegateProxy<FilledTextField, FilledTextFieldDelegate>, | |
FilledTextFieldDelegate, | |
DelegateProxyType { | |
init(filledTextField: FilledTextField) { |
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
@objc protocol FilledTextFieldDelegate: class { | |
@objc optional func filledTextField(_ filledTextField: FilledTextField, textFieldTextDidChange _: String) | |
@objc optional func filledTextFieldDidBeginFocusing(_ textField: FilledTextField) | |
} |
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
private lazy var nameTextField: CustomTextField = { | |
let view = CustomTextField(frame: .zero) | |
view.delegate = self | |
view.textField.keyboardType = .emailAddress | |
view.iconImageView.image = UIImage(named: "account") | |
view.defaultPlaceholderText = "User name" | |
return view | |
}() | |
func customTextField(_ customTextField: CustomTextField, textFieldDidChange text: String?) { |
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
private lazy var nameTextField: CustomTextField = { | |
let view = CustomTextField(frame: .zero) | |
view.textField.keyboardType = .emailAddress | |
view.iconImageView.image = UIImage(named: "account") | |
view.defaultPlaceholderText = "User name" | |
view.rx.textDidChange.asDriver().drive(onNext: { | |
print($0) | |
}).disposed(by: bag) | |
return view | |
}() |
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 SwiftyXMLParsable | |
protocol XMLParsable { | |
init(accessor: XML.Accessor) | |
} |
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 SwiftyXMLParsable | |
struct Station { | |
var id: String | |
var name: String | |
var programs: [Program] = [] | |
} | |
extension Station: XMLParsable { |
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 RxSwift | |
import SwiftyXMLParser | |
class RadikoService: NSObject { | |
func get(aid: String) -> Single<[Station]?> { | |
return Network.xmlProvider.rx.request(.station(aid: "JP13")) // 東京の番組を取得 | |
.map { $0.data } // Moya.Response -> Data | |
.map { XML.parse($0)} // Data -> XML.Accessor |
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 SwiftyXMLParsable | |
struct Program { | |
var title: String | |
var url: URL? | |
var personality: String | |
var imageUrl: URL? | |
var metas: [Meta] | |
} |