Skip to content

Instantly share code, notes, and snippets.

@froggomad
Created July 8, 2021 14:49
Show Gist options
  • Save froggomad/da35b3a39ef1871d8f2be4b2d82401f6 to your computer and use it in GitHub Desktop.
Save froggomad/da35b3a39ef1871d8f2be4b2d82401f6 to your computer and use it in GitHub Desktop.
import UIKit
class InstructionViewController: UIViewController {
var titleText: String
var instructions: String
var image: UIImage
var caption: String?
var buttonTitle: String
lazy var instructionView: InstructionView = {
InstructionView(title: titleText,
instructions: instructions,
image: image,
caption: caption,
buttonTitle: buttonTitle,
target: self,
selector: #selector(openSettings)
)
}()
init(title: String, instructions: String, image: UIImage, caption: String? = nil, buttonTitle: String) {
self.titleText = title
self.instructions = instructions
self.image = image
self.caption = caption
self.buttonTitle = buttonTitle
super.init(nibName: nil, bundle: nil)
}
required init?(coder: NSCoder) {
fatalError("programmatic view")
}
override func loadView() {
view = instructionView
}
@objc private func openSettings() {
AppSettingsController.openSettings()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment