open AppConsole/Demo/ViewController/ViewController.xcworkspace
// part of ViewController.swift
class ViewController: UIViewController {
@IBOutlet var label: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
label.text = AppConsole(initial: self).run()
}
...
In [1]:
using Swifter
In [2]:
vc = initial("http://localhost:8080")
Out[2]:
In [3]:
@query vc.view
Out[3]:
In [4]:
@query vc.view.backgroundColor = UIColor.yellowColor()
Out[4]:
In [5]:
@query vc.view
Out[5]:
In [6]:
@query vc.label.text = "Hello Swift"
Out[6]:
In [7]:
@query vc.label.numberOfLines
Out[7]:
In [8]:
@query vc.label.text = "Hello Swift\nHello Julia"
Out[8]:
In [9]:
@query vc.label.font = UIFont(name: "Helvetica", size: 35)
Out[9]:
In [10]:
@query vc.label
Out[10]:
In [11]:
@query vc.label.backgroundColor = UIColor.cyanColor()
Out[11]:
In [12]:
@query vc.label
Out[12]:
In [13]:
@query vc.view.subviews
Out[13]:
In [14]:
@query vc.view.subviews[0].backgroundColor = UIColor.orangeColor()
Out[14]:
In [15]:
@query vc.view
Out[15]:
In [16]:
(Left, Center, Right) = (0, 1, 2)
Out[16]:
In [17]:
@query vc.label.textAlignment
Out[17]:
In [18]:
@query vc.label.textAlignment = Center
Out[18]:
In [19]:
@query vc.label.frame
Out[19]:
In [20]:
@query vc.label.frame = "{{20, 300}, {280, 200}}"
Out[20]:
In [21]:
@query UIScreen.mainScreen()
Out[21]:
In [22]:
ENV["SWIFTER_SAVE_IMAGE"] = false
Out[22]: