SwifterSwift v4.2.0 Release Notes

Release Date: 2018-03-11 // about 6 years ago
  • ➕ Added

    • MKPolyline
      • Added .coordinates property, to return an array of coordinates for the provided polyline. #416 by @freak4pc.
      • Added init(coordinates:) initializer, to initialize a MKPolyline with a provided array of coordinates. #416 by @freak4pc.
    • Optional
      • Added .unwrapped(or:) method, to get the value wrapped by an optional or throw a custom error. #413 by @calebkleveter.
    • UIButton
      • added centerTextAndImage(spacing:) to Center align title text and image on UIButton. #365 by @imjog.
    • Array
      • added divided(by:) to separate an array into 2 arrays based on a predicate. #367 by @neoneye.
    • Int
      • added roundToNearest(n:) to round an integer to the closest multiple of a given n. #381 by MaxHaertwig.
    • FileManager
      • added jsonFromFile(atPath path:, readingOptions:) to open a JSON file and serialize its content to a [String, Any]? instance with a provided path. #390 by jason-ingenuity.
      • added jsonFromFile(withFilename filename:, at bundleClass:, readingOptions:) to open a JSON file and serialize its content to a [String, Any]? instance given a filename. #390 by jason-ingenuity.
    • Int
      • added a more performant and memory efficient digits property to return array of integers. #393 by FrankKair.
    • StringProtocol
      • added commonSuffix(with:, options:) to get the longest common suffix of the receiver and a given string. #379 by MaxHaertwig.
    • UICollectionView
      • added register(nibWithCellClass:, at bundleClass:) method to be able to register a cell with custom nib just by its class name. #386 by jason-ingenuity.
    • UIFont
    • UIImage
      • added withRoundedCorners(radius:) to round the corners of an image. The parameter radius is optional, the resulting image will be round if it is unspecified. #380 by MaxHaertwig.
    • UITableView
      • added register(nibWithCellClass:, at bundleClass:) method to be able to register a cell with custom nib just by its class name. #386 by jason-ingenuity.
    • URL
      • added queryParmeters property to get the query parameters from a URL as a dictionary. #370 by nathanbacon.
      • added thumbnail(fromTime:) to generate a thumbnail image from a given url. 410 by BennX.
    • 0️⃣ UserDefaults
      • added object(type: with key: usingDecoder decoder:) method to be able to retrieve Codable objects from UserDefaults. #388 by jason-ingenuity.
      • added set(codable: forKey key: usingEncoder encoder:) method to be able to store Codable objects from UserDefaults. #388 by jason-ingenuity.
    • String
      • added computed property isWhitespace to check if the given string is blank or not.#363 by rkp1026.
      • added isDigits to check if string only contains digits. #396 by seifeet.
      • added toSlug() to return a slug version of a given string. 397# by FrankKair
    • New UIStackView
      • added init(arrangedSubviews:, axis:, spacing:, alignment:, distribution:) to directly initialize a UIStackView with an array of UIViews. #409 by BennX

    🛠 Fixed

    • String
      • Fixed isNumeric to check if string is a valid Swift number and added isDigits to check if string only contains digits. #396 by seifeet.
    • Collection