Upgrade to Pro — share decks privately, control downloads, hide ads and more …

MapSwift - lesson 3

leveton
May 10, 2017
31

MapSwift - lesson 3

leveton

May 10, 2017
Tweet

Transcript

  1. Devices Manage both physical and simulated devices. Xcode comes with

    some simulators but others need to be downloaded. Every time you switch to a new device, you should allow Xcode to index the files.
  2. Organizer Window > Organizer The organizer used to be prominently

    featured because it had more responsibilities (e.g. provisioning). Now it’s mainly used to upload binaries to the App Store.
  3. Used often by UIKit You can call a method without

    having to instantiate an object and use up memory. class methods
  4. Initializers Initializers are good when you want a default value

    for a class or struct to be set once and then be immutable. The boat object has an engine and its cylinder count will be whatever you initialize it to.
  5. Initializers If you create a struct with a custom initializer,

    you cannot then use the default initializer. boat’s engine is initialized properly but titanic’s is not.
  6. Core geometry CGPoint public struct CGPoint { public var x:

    CGFloat public var y: CGFloat } CGSize struct CGSize { CGFloat width CGFloat height } CGRect (combines CGPoint and CGSize) struct CGRect { public var origin: CGPoint public var size: CGSize }
  7. Core geometry Remember, most UIKit objects are subclasses of UIView

    and UIView has a frame property which is just a CGRect
  8. Core geometry Views also have a bounds property. Also a

    CGRect. The difference is that a view’s frame is relative to the superview while a view’s bounds is relative to itself. The origin of a bounds value is always 0,0. A view’s bounds is usually the same as its frame BUT a rotated view will have different sizes for its bounds and frame.
  9. CG helper methods .width, .height - self-explanatory maxX - gets

    the width + the x-offset maxY - gets the height + the y-offset minX - returns the smallest value for the view’s x-coordinate minY - returns the smallest value for the view’s y-coordinate
  10. Core geometry Remember, most UIKit objects are subclasses of UIView

    which has a frame property of type GCRect. Core Geometry is like reading - left to right, top to bottom
  11. retina, retina-HD, pixels and points One point does not necessarily

    correspond to one physical pixel. On a device with a retina screen, a line that is one point wide may actually result in a line that is two physical pixels wide.
  12. retina, retina-HD, pixels and points Points are to pixels what

    percentages are to integers. 1% of the screen may be one pixel or three pixels depending on the hardware. retina-HD iPhone 7 has 401 pixels per inch as opposed to an iPhone 6 with 326 pixels per inch.