1
0
mirror of https://github.com/flutter/samples.git synced 2026-04-04 18:51:05 +00:00

Maintenance updates for platform_view_swift (#151)

This commit is contained in:
Andrew Brogdon
2019-10-09 09:25:03 -07:00
committed by GitHub
parent 497c25b154
commit f4a8247634
34 changed files with 492 additions and 468 deletions

View File

@@ -6,32 +6,32 @@ import UIKit
import Foundation
protocol PlatformViewControllerDelegate {
func didUpdateCounter(counter: Int)
func didUpdateCounter(counter: Int)
}
class PlatformViewController : UIViewController {
var delegate: PlatformViewControllerDelegate? = nil
var counter: Int = 0
@IBOutlet weak var incrementLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
setIncrementLabelText()
}
func handleIncrement(_ sender: Any) {
self.counter += 1
self.setIncrementLabelText()
}
func switchToFlutterView(_ sender: Any) {
self.delegate?.didUpdateCounter(counter: self.counter)
dismiss(animated:false, completion:nil)
}
func setIncrementLabelText() {
let text = String(format: "Button tapped %d %@", self.counter, (self.counter == 1) ? "time" : "times")
self.incrementLabel.text = text;
}
var delegate: PlatformViewControllerDelegate? = nil
var counter: Int = 0
@IBOutlet weak var incrementLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
setIncrementLabelText()
}
@IBAction func handleIncrement(_ sender: Any) {
self.counter += 1
self.setIncrementLabelText()
}
@IBAction func switchToFlutterView(_ sender: Any) {
self.delegate?.didUpdateCounter(counter: self.counter)
dismiss(animated:false, completion:nil)
}
func setIncrementLabelText() {
let text = String(format: "Button tapped %d %@", self.counter, (self.counter == 1) ? "time" : "times")
self.incrementLabel.text = text;
}
}