• Blog

    Date Format

      The following tables are for a developer’s reference, to show the Date Format in Swift 4.   Using dateStyle and timeStyle properties let formatter = DateFormatter() formatter.dateStyle = .full formatter.timeStyle = .full let dateString = formatter.string(from: Date()) Tuesday, October 30, 2018 at 9:48:38 PM Pacific Daylight Time     Using format strings let formatter = DateFormatter() formatter.dateFormat = "y, M, d, E, h:m:s, a" let dateString = formatter.string(from: Date()) 2018, 10, 30, Tue, 9:54:37, PM  

  • Blog

    Remainder Operator

    Basic Operators in Swift Addition (+) Subtraction (-) Multiplication (*) Division (/)  Remainder Operator (%)     (similar to the Mod or Modulo operator in some other languages) The Remainder Operator Here is a brief explanation of the remainder operator (%) as it works in the Swift language, quoted from Swift’s website: The remainder operator (a % b) works out how many multiples of b will fit inside a and returns the value that is left over (known as the remainder). Note: The remainder operator (%) is also known as a modulo operator in other languages. However, its behavior in Swift for…