Edited at





public struct CGPoint {

public var x: CGFloat

public var y: CGFloat

public init()

public init(x: CGFloat, y: CGFloat)



public struct CGSize {

public var width: CGFloat

public var height: CGFloat

public init()

public init(width: CGFloat, height: CGFloat)



public struct CGRect {

public var origin: CGPoint

public var size: CGSize

public init()

public init(origin: CGPoint, size: CGSize)



extension UIView {

// animatable. do not use frame if view is transformed since it will not correctly reflect the actual location of the view. use bounds + center instead.
open var frame: CGRect

// use bounds/center and not frame if non-identity transform. if bounds dimension is odd, center may be have fractional part
open var bounds: CGRect // default bounds is zero origin, frame size. animatable

open var center: CGPoint // center is center of frame. animatable

open var transform: CGAffineTransform // default is CGAffineTransformIdentity. animatable

@available(iOS 4.0, *)
open var contentScaleFactor: CGFloat

open var isMultipleTouchEnabled: Bool // default is NO

open var isExclusiveTouch: Bool // default is NO

open func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? // recursively calls -pointInside:withEvent:. point is in the receiver's coordinate system

open func point(inside point: CGPoint, with event: UIEvent?) -> Bool // default returns YES if point is in bounds

open func convert(_ point: CGPoint, to view: UIView?) -> CGPoint

open func convert(_ point: CGPoint, from view: UIView?) -> CGPoint

open func convert(_ rect: CGRect, to view: UIView?) -> CGRect

open func convert(_ rect: CGRect, from view: UIView?) -> CGRect

open var autoresizesSubviews: Bool // default is YES. if set, subviews are adjusted according to their autoresizingMask if self.bounds changes

open var autoresizingMask: UIViewAutoresizing // simple resize. default is UIViewAutoresizingNone

open func sizeThatFits(_ size: CGSize) -> CGSize // return 'best' size to fit given size. does not actually resize view. Default is return existing view size

open func sizeToFit() // calls sizeThatFits: with current view bounds and changes bounds size.


(CGPoint型, CGSize型, CGRect型)は宣言できるがframe型は存在しないframeはUIViewの作成を行う時にCGRectを入れておく変数名!

let point:CGPoint = CGPoint(x:0, y:0)

let size:CGSize = CGSize(width:100, height:100)

let cgrect:CGRect = CGRect(x:0, y:0, width:100, height:100 )
let cgrect1:CGRect = CGRect(origin: CGPoint(x:0, y:0),

let frame:CGRect = CGRect(x: 0, y: 0, width: 100, height: 100)
var myVeiw:UIView = UIView(frame: frame)


let frame:frame = frame(x: 0, y: 0, width: 100, height: 100)


var x:CGFloat = self.view.bounds.origin.x

var y:CGFloat = self.view.bounds.origin.x
var width:CGFloat = self.view.bounds.size.width
var height:CGFloat = self.view.bounds.size.height