Created
March 10, 2020 10:35
-
-
Save b-onc/4416132a0ec4ebe1c1791b451500f36e to your computer and use it in GitHub Desktop.
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 func setupUI() { | |
view.addSubview(cameraButton) | |
cameraButton.translatesAutoresizingMaskIntoConstraints = false | |
cameraButton.setImage(UIImage(systemName: "camera.fill", | |
withConfiguration: UIImage.SymbolConfiguration(font: .systemFont(ofSize: 24))), | |
for: .normal) | |
cameraButton.tintColor = UIColor.gray.withAlphaComponent(0.7) | |
view.addSubview(soundRecordButton) | |
soundRecordButton.translatesAutoresizingMaskIntoConstraints = false | |
soundRecordButton.setImage(UIImage(systemName: "waveform.circle.fill", | |
withConfiguration: UIImage.SymbolConfiguration(font: .systemFont(ofSize: 30, weight: .bold))), | |
for: .normal) | |
soundRecordButton.tintColor = UIColor.gray.withAlphaComponent(0.7) | |
NSLayoutConstraint.activate([ | |
cameraButton.centerYAnchor.constraint(equalTo: composerView.centerYAnchor), | |
cameraButton.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 16), | |
cameraButton.heightAnchor.constraint(equalToConstant: 40), | |
soundRecordButton.centerYAnchor.constraint(equalTo: composerView.centerYAnchor), | |
soundRecordButton.rightAnchor.constraint(equalTo: composerView.rightAnchor, constant: -2), | |
]) | |
composerView | |
.sendButtonVisibility | |
.asDriver(onErrorJustReturn: (isHidden: false, isEnabled: false)) | |
.drive(onNext: { [weak self] state in | |
self?.soundRecordButton.isHidden = !state.isHidden | |
}).disposed(by: disposeBag) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment