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
let view = [Text (...), ...].group() |
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
let view = Group( | |
contents: [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
let swiftUIView = SwiftUIView() | |
let viewController = UIHostingController(rootView: swiftUIView) |
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
# create logic contract | |
let myContract1 = await MyContract1.new() | |
# create a proxy which reference the logic contract | |
let proxy = await AdminUpgradeabilityProxy.new(myContract1.address) | |
# wrap proxy with the contract API | |
var wrapper = await MyContract1.at(proxy.address) | |
# initialize the contract | |
await wrapper.initialize(42) | |
console.log(await wrapper.value()) // 42 |
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
## Installation | |
npm install --global zos | |
npm install --global ganache-cli | |
## Create new project | |
mkdir {project} && cd {project} | |
npm init | |
zos init {project} | |
npm install zos-lib |
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
@Published var title: String = "" | |
//And then you can change the variable itself: | |
title = "Bob" | |
//And also to track its changes: | |
let titleSubscription = $title.sink { | |
print("new title is '\($0)'") | |
} |
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
class ViewController: UIViewController { | |
@IBOutlet weak var loginTextField: UITextField? | |
@IBOutlet weak var passwordTextField: UITextField? | |
@IBOutlet weak var loginButton: UIButton? | |
private let disposeBag = DisposeBag() | |
private let viewModel = ViewModel() | |
override func viewDidLoad() { |
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
override func viewDidLoad() { | |
super.viewDidLoad() | |
loginButton?.isEnabled = false | |
guard let loginTextField = loginTextField, | |
let passwordTextField = passwordTextField, | |
let loginButton = loginButton else { | |
return | |
} |
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 UIKit | |
class ViewController: UIViewController { | |
@IBOutlet weak var loginTextField: UITextField? | |
@IBOutlet weak var passwordTextField: UITextField? | |
@IBOutlet weak var loginButton: UIButton? | |
override func viewDidLoad() { | |
super.viewDidLoad() |
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 dynamic var titleKVO: String = "" | |
var titleObserver: Observable<String> { | |
return rx.observe(String.self, "titleKVO", options: .new) //using an Rx wrapper for KVO we can monitor new values of | |
} | |
let disposeBag = DisposeBag() | |
titleObserver | |
.subscribe(onNext: { title in | |
titleLabel.text = title |