var myString = "Hello world! - swift.jsrun.net"
print(myString)
import UIKit
class CoreGraphUIView: UIView {
override func touchesBegan (_touches: Set<UITouch>,with event: UIEvent?) {
self.backgroundColor = UIColor.red
print ("Began: \(touches) ")
}
override func touchesEnded (_touches: Set<UITouch>, with event: UIEvent?) {
self. backgroundColor = UIColor.lightGray
print ("Ended: \(touches) ")
}
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?){
self. backgroundColor = UIColor.blue
print ("Moved: \ (touches) ")
}
}
class ViewController: UIViewController{
override func viewDidLoad () {
super.viewDidLoad ()
let height = self.view.frame.size.height
let width = self.view.frame.size.width
let graphFrame = CGRect (x: 0, y: 0, width: width,height: height)
let graphView = CoreGraphUIView (frame: graphFrame)
graphView.backgroundColor = UIColor.white
self.view.addSubview (graphView)
}
}
let touch:UITouch = touches.first! as UITouch
print(touch.location(in: view).x)
print(touch.location(in: view).y)
class Shape {
var name : String?
var sides : Int?
Val origin : CGPoint?
var lineColor : UIColor = UICOLOr.red
var filColor : UICOLOr = UrCoLor.green
var linewiath : CGELoat = 2
init (name: String, sides : Int, origin: CGPoint) {
self. name = name
self.sides = sides
self.origin = origin
}
func sayhello () {
print ( "Shape is \(name!), sides \(sides!), and originCord is (\(origin!.x), \(origin!.y))")
}
}
Import UInit
class Shape {
var name : String?
var sides : Int?
var origin : CGPoint?
var linecolor : UIColor = UICOlor.red
var fillColor : UIColor = UIColor.green
var lineWidth: CGFloat = 2
init (name : String, sides : Int, origin、