in ios/SpectrumKitSample/SpectrumKitSample-iOS/SpectrumView.swift [70:106]
func updateView(with viewModel: SpectrumViewModel) {
self.sourceImageView.image = viewModel.source.image
self.sourceImageButton.setTitle(viewModel.sourceImageDescription, for: .normal)
self.inputTypeButton.setTitle(viewModel.inputType.title, for: .normal)
self.outputTypeButton.setTitle(viewModel.outputType.title, for: .normal)
self.outputFormatButton.setTitle(viewModel.outputFormat.title, for: .normal)
self.compressionModeButton.setTitle(viewModel.compressionMode.title, for: .normal)
self.qualityButton.currentOption = viewModel.quality
self.rotationButton.setTitle(viewModel.rotation.title, for: .normal)
self.scalingButton.setTitle(viewModel.scaling.title, for: .normal)
self.croppingButton.setTitle(viewModel.cropping.title, for: .normal)
self.transcodeButton.isEnabled = viewModel.isTranscodeButtonEnabled
UIView.performWithoutAnimation {
self.transcodeButton.setTitle(viewModel.actionButtonTitle, for: .normal)
self.transcodeButton.layoutIfNeeded()
}
self.stackView.isUserInteractionEnabled = viewModel.isTranscoding == false
if self.modeContainerView.isHidden == viewModel.showsEncodingMode {
UIView.animate(withDuration: 0.4) {
self.modeContainerView.isHidden = viewModel.showsEncodingMode == false
}
}
if self.qualityContainerView.isHidden == viewModel.showsQuality {
UIView.animate(withDuration: 0.4) {
self.qualityContainerView.isHidden = viewModel.showsQuality == false
}
}
if self.outputFormatContainerView.isHidden == viewModel.showsOutputFormat {
UIView.animate(withDuration: 0.4) {
self.outputFormatContainerView.isHidden = viewModel.showsOutputFormat == false
}
}
}