private let selectedPhotos = BehaviorRelay<[PHAsset]>(value: [])
private lazy var completeButton = UIBarButtonItem(title: "확인",
style: .plain,
target: nil,
action: nil)
A variable is declared.
private func bind() {
selectedPhotos.asObservable()
.map { $0.isEmpty }
.bind(to: completeButton.rx.isHidden)
.disposed(by: disposeBag)
}
"Cannot assign to property: ‘self’ is immutable"
I got this error
"completeButton.rx.isHidden" is underlined.
These codes are written in class
2
Answers
I solved it thanks to you. UIBarButtonItem supports isHidden from 16.0. But I am wondering why this error occurs
Originally, I know that this error occurs
as you mentioned
is declared as a
let
constant.Use
var
instead.If it’s declared inside a viewController (that is a class of course) this way it should become mutable.