{"id":15038744,"url":"https://github.com/damonthecricket/my-utils","last_synced_at":"2026-01-29T07:40:19.708Z","repository":{"id":62447438,"uuid":"90168944","full_name":"damonthecricket/my-utils","owner":"damonthecricket","description":"Simple Cocoa  Swift library. ","archived":false,"fork":false,"pushed_at":"2018-08-30T16:30:39.000Z","size":3417,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-12T07:20:11.280Z","etag":null,"topics":["apple","code","framework","ios","iphone","ipod","library","macos","osx","swift","swift-3","swift-4","tvos","watchos"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/damonthecricket.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-03T16:13:34.000Z","updated_at":"2018-03-20T14:26:16.000Z","dependencies_parsed_at":"2022-11-01T22:16:51.966Z","dependency_job_id":null,"html_url":"https://github.com/damonthecricket/my-utils","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/damonthecricket/my-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damonthecricket%2Fmy-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damonthecricket%2Fmy-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damonthecricket%2Fmy-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damonthecricket%2Fmy-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/damonthecricket","download_url":"https://codeload.github.com/damonthecricket/my-utils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damonthecricket%2Fmy-utils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28718962,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T05:53:42.649Z","status":"ssl_error","status_checked_at":"2026-01-24T05:53:41.698Z","response_time":89,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apple","code","framework","ios","iphone","ipod","library","macos","osx","swift","swift-3","swift-4","tvos","watchos"],"created_at":"2024-09-24T20:40:00.112Z","updated_at":"2026-01-29T07:40:19.693Z","avatar_url":"https://github.com/damonthecricket.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MYUtils.\n[![Version](https://img.shields.io/github/release/damonthecricket/my-utils.svg)](https://github.com/damonthecricket/my-utils/releases)\n[![Travis CI](https://travis-ci.org/damonthecricket/my-utils.svg?branch=master)](https://travis-ci.org/damonthecricket/my-utils)\n![CocoaPods](https://img.shields.io/cocoapods/v/MYUtils.svg)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![GitHub license](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://raw.githubusercontent.com/damonthecricket/my-utils/master/LICENSE)\n![Platform](https://img.shields.io/badge/platforms-iOS%208.0+%20%7C%20macOS%2010.10+%20%7C%20tvOS%209.0+%20%7C%20watchOS%202.0+-333333.svg)\n\n![MYJSON](https://github.com/damonthecricket/my-utils/blob/README/my-utils-lib.jpg)\n\nMYUtils is a simple Swift library, that extends Cocoa frameworks.\n\n1. [Features](#features)\n2. [Installation](#installation)\n3. [Requirements](#requirements)\n4. [Usage](#usage)\n\n### Features.\n\n1. [UI](#ui)\n   - Classes\n      - Storyboard Segues\n   - Extensions\n      - CoreGraphics\n      - Image\n      - View\n      - ViewController\n2. [Foundation](#foundation)\n   - Classes\n      - Cache\n      - Result\n   - Extensions\n      - Array\n      - Dictionary\n      - Double\n      - Float\n      - Int\n      - NotificationCenter\n      - NSNumber\n      - OperationQueue\n      - String\n      - Timer\n      - UserDefaults\n\n### Installation.\n- #### [CocoaPods](http://cocoapods.org/)\n\n  ```ruby\n  use_frameworks!\n  \n  pod 'MYUtils'\n  ```\n\n- #### [Carthage](https://github.com/Carthage/Carthage)\n\n  ```\n  github \"damonthecricket/my-utils\"\n  ```\n\n- #### [Git](https://git-scm.com/)\n\n  ```\n  $ git submodule add https://github.com/damonthecricket/my-utils.git\n  ```\n- #### Manually\n\n  - Copy MYUtils to the root of your project.\n  \n  - Add it in file inspector of your project.\n  \n  - Go to Targets -\u003e Add MYUtils to Embedded Binaries.\n\n### Requirements.\n\n - iOS 8.0+  |  macOS 10.10+  |  tvOS 9.0+  |  watchOS 2.0+.\n \n - Xcode 8.3\n \n - Swift 3.\n\n### Usage.\n\n#### UI:\n##### - Classes:\n  - ```DismissStoryboardSegue``` is intended to dismiss ViewController using Storyboard, not programmatically. All we need \n    is control-click an appropriate element in the first ViewController and drag to the target ViewController (or to itself)   \n    that was presented via ``` func present(UIViewController, animated: Bool, completion: (() -\u003e Void)? = nil) ``` method.    \n    Then make storyboard segue kind custom and assign ```DismissStoryboardSegue``` to its class in appropriate text field.\n    \n    Available in iOS 8.0+  |  macOS 10.10+  |  tvOS 9.0+.\n   \n  - ```ShowStoryboardSegue``` is intended to add ViewController as a child ViewController using Storyboard. All we need is\n    control-click an appropriate element in the first ViewController and drag to the target ViewController. Then make \n    storyboard segue kind custom and assign ```ShowStoryboardSegue``` to its class in appropriate text field.\n    \n    Available in iOS 8.0+  |  macOS 10.10+  |  tvOS 9.0+.\n    \n  - ```HideStoryboardSegue``` is intended to remove ViewController from its parent ViewController using Storyboard. All we \n    need is control-click an appropriate element in the first ViewController and drag to the target ViewController. Then   \n    make  storyboard segue kind custom and assign ```HideStoryboardSegue``` to its class in appropriate text field.\n    \n    Available in iOS 8.0+  |  macOS 10.10+  |  tvOS 9.0+.\n    \n  - ```PopStoryboardSegue``` is intended to pop ViewController from its UINavigationController stack using Storyboard.\n    All we need is control-click an appropriate element in the source ViewController and drag to itsel. Then make storyboard\n    segue kind custom and assign ```PopStoryboardSegue``` to its class in appropriate text field.\n    \n    Available in iOS 8.0+  |  tvOS 9.0+.\n      \n##### - Extensions:\n   ```CGRect``` extensions provides easy way to perform arithmetic operations on the ```CGRect, CGPoint, CGSize``` \n   structures.\n   ```swift\n   let firstRect  = CGRect(x: 10.0, y: 0.0, width: 100.0, height: 100.0)\n   let secondRect = CGRect(x: 10.0, y: 100.0, width: 200.0, height: 10.0)\n      \n   let sumResultRect = firstRect + secondRect\n   let minusResultRect = firstRect - secondRect\n   let multiplicationResultRect = firstRect * secondRect\n   let divisionResultRect = firstRect / secodeRect\n      \n   // sumResultRect will be equal to x: 20.0 y: 100.0 width: 300.0 height: 110.0 rect.\n   // minusResultRect will be equal to x: 0.0 y: -100.0 width: -100.0 height: 90.0 rect.\n   // multiplicationResultRect will be equal to x: 100.0 y: 0.0 width: 20 000.0 height: 1 000.0 rect.\n   // divisionResultRect will be equal to x: 1.0 y: 0.0 width: 0.5 height: 10.0 rect.\n   ```\n   Available in iOS 8.0+  |  macOS 10.10+  |  tvOS 9.0+  |  watchOS 2.0+.\n\n   ```CGFloat``` extensions includes opportunities to generate random numbers.\n   ```swift\n   let randomNumberInRange = CGFloat.random(min: 0.0, max: 10.0)\n   let random = CGFloat.random\n   let randomSign = CGFloat.randomSign\n      \n   // randomNumberInRange will be equal to number in range between 0.0 and 10.0 inclusive.\n   // random will be equal to number in range between 0.0 and 1.0 inclusive.\n   // randomSign will be equal to number 1.0 or -1.0.\n   ```\n   Available in iOS 8.0+  |  macOS 10.10+  |  tvOS 9.0+  |  watchOS 2.0+.\n   \n   ```Image``` extensions provides next opportunites:\n   - Identify image orientation:\n      ```swift\n      let image = \u003cimage initialization...\u003e\n      switch image.orientation {\n         case .portret:\n            // When image has portret orientation.\n         case .album:\n            // When image has album orientation.            \n         case .square:\n            // When image has square form.                        \n      }\n      \n      // Or use follow.\n      \n      if image.isPortret {\n         // When image has portret orientation.\n      } else if image.isAlbum {\n         // When image has album orientation.         \n      } else if image.isSquare {\n         // When image has square form.                        \n      }   \n      ```\n     Available in iOS 8.0+  |  macOS 10.10+  |  tvOS 9.0+  |  watchOS 2.0+.\n\n  - Load image from rest resource:\n      ```swift\n      let url = \u003cURL initialization...\u003e\n      UIImage.from(URL: url) {image in\n         // In case of success this method loads / returns cached and provides in closure an image.\n         // Oterwise, an image equals to `nil`.\n      }\n      ```\n    Available in iOS 8.0+  |  macOS 10.10+  |  tvOS 9.0+  |  watchOS 2.0+.\n\n  - Draw image:\n      ```swift\n      let size = \u003cCGSize initialization...\u003e\n      let image = MYImageDraw(size: size) {ctx in\n         ctx.setFillColor(color.cgColor)\n      }\n      ```\n    Available in iOS 8.0+  |  macOS 10.10+  |  tvOS 9.0+  |  watchOS 2.0+.\n     \n  - Image cache:\n  ```MYImage.cache``` is used by ```MYImage.imageFrom(URL url: URL, completion: MYImageDownloadCompletion? = nil)``` and\n  ```MYImageView.imageFrom(URL url: URL, completion: MYImageDownloadCompletion? = nil)``` methods to cache downloaded\n     images.\n    Available in iOS 8.0+  |  macOS 10.10+  |  tvOS 9.0+  |  watchOS 2.0+.\n  \n  ```ImageView``` extensions provides next opportunities:\n  ```swift\n  let url = \u003cURL initialization...\u003e\n  let imageView = \u003cImage initialization...\u003e\n  imageView.imageFrom(URL: url) {image\n      // In case of success this method loads or returns cached, sets to reciever and provides in closure an image.\n      // Oterwise, image equals to nil.\n  }\n  ```\n  Available in iOS 8.0+  |  macOS 10.10+  |  tvOS 9.0+  |  watchOS 2.0+.\n  \n  ```CollectionView``` extensions provides next opportunity:\n  - Adjusting of number of columns:\n      ```swift\n      let collectionView = \u003cCollectionView initialization...\u003e\n      collectionView.numberOfCellsPerRow = 3 // CollectionView will layout three collection view cells in each row.\n      ```\n    Available in iOS 8.0+  |  macOS 10.11+  |  tvOS 9.0+.\n   \n  ```ScrollView``` extensions provodes next opportunites:\n  - Identify current scroll content position:\n      ```swift\n      let scrollView = \u003cScrollView initialization...\u003e\n      switch scrollView.position {\n      case .top:\n         // When scroll content position on top.\n      case .right:\n         // When scroll content position on right.\n      case .bottom:\n         // When scroll content position on bottom.\n      case .left:\n         // When scroll content position on left.\n      case .center:\n         // When scroll content position on center.  \n      }\n  \n      // Or you can use next methods.\n  \n      if scrollView.onTop {\n         // When scroll content position on center.        \n      } else if scrollView.onRight {\n         // When scroll content position on right.   \n      } else if scrollView.onBottom {\n         // When scroll content position on bottom.  \n      } else if scrollView.onLeft {\n         // When scroll content position on left.\n      } else if scrollView.onCenter {\n         // When scroll content position on center.\n      }\n      ```  \n    Available in iOS 8.0+  |  macOS 10.10+  |  tvOS 9.0+  |  watchOS 2.0+.\n  \n  - Get content offset for macOS 10.11+:\n      ```swift\n      let scrollView = \u003cScrollView initialization...\u003e\n      let contentOffset =  scrollView.contentOffset\n      ```\n    Available in macOS 10.11+.\n\n  - Identify current scroll direction:\n      ```swift\n      let scrollView = \u003cScrollView initialization...\u003e\n      switch scrollView.direction {\n      case .vertical:\n         // When scroll direction is vertical.\n      case .horizontal:\n         // When scroll direction is horizontal.\n      }\n  \n      // Or you can use next methods.\n  \n      if scrollView.isVertical {\n         // When scroll direction is vertical.\n      } else if scrollView.isHorizontal {\n         // When scroll direction is horizontal.      \n      }\n      ```  \n    Available in iOS 8.0+  |  macOS 10.10+  |  tvOS 9.0+.\n  \n  - Get actual scroll view content size:\n      ```swift\n      let scrollView = \u003cScrollView initialization...\u003e\n      let contentSize = scrollView.contentSize\n      ```\n    Available in iOS 8.0+  |  macOS 10.10+  |  tvOS 9.0+.\n  \n  ```UIActivityViewController``` extensions provides next opportunities:\n  - Easy way to initialize ```UIActivityViewController```:\n      ```swift\n      let string = \u003cString initialization...\u003e \n      let url = \u003cURL initialization...\u003e\n    \n      let activityViewController = UIActivityViewController(activityItems: [string, url], applicationActivities: nil) {        \n         activityType, completed, returnedItems, activityError in\n         // Completion code.\n      }\n      ```\n    Available in iOS 8.0+.\n  \n  ```UIAlertController``` extensions provides next opportunities:\n  - Easy way to present ```UIAlertController```:\n      ```swift\n      let title = \u003cString initialization...\u003e\n      let message = \u003cString initialization...\u003e\n      let actions = \u003cUIAlertAction array initialization...\u003e\n      let style = \u003cUIAlertControllerStyle initialization...\u003e\n      let vc = \u003cUIViewController initialization...\u003e\n    \n      UIAlertShow(title, message, actions, style, vc)  // vc presents UIAlertController with specified attributes.\n      ```\n    Available in iOS 8.0+.\n\n  - Easy way to make ```UIAlertAction```:\n      ```swift\n      let action = UIAlertActionMake(title: \"Ok\", .default) {action in\n         // Completion code.\n      }\n  \n      let cancelAction = UIAlertActionMakeCancel(title: \"Cancel\", .cancel) {action in\n         // Completion code.\n      }\n  \n      let defaultAction = UIAlertActionMake(title: \"Done\") {action in\n         // Completion code.\n      }\n      ```\n    Available in iOS 8.0+  |  tvOS 9.0+.\n    \n  ```UINavigationController``` extensions provides next opportunities: [#ui_view_cotroller_extensions]\n  - Get root view controller:\n      ```swift\n      let navigatioController = \u003cUINavigationController initialization...\u003e\n    \n      let rootViewController = navigationController.rootViewController\n      ```\n    Available in iOS 8.0+  |  tvOS 9.0+.\n\n  ```ViewController``` extensions provides next opportunities:\n  - Get current child view controller:\n      ```swift\n      let viewController = \u003cViewController initialization...\u003e\n    \n      let currentChildViewController = viewController.currentViewController\n      ```\n    Available in iOS 8.0+  |  macOS 10.10+  |  tvOS 9.0+.\n  \n  - Get previous child view controller:\n      ```swift\n      let viewController = \u003cViewController initialization...\u003e\n  \n      let currentChildViewController = viewController.previousViewController\n      ```\n    Available in iOS 8.0+  |  macOS 10.10+  |  tvOS 9.0+.\n  \n  - Add view controller:\n      ```swift\n      let parentViewController = \u003cViewController initialization...\u003e\n      let childViewController = \u003cViewController initialization...\u003e\n  \n      parentViewController.addChild(viewController: childViewController) {\n         childViewController.view.frame = CGRect(x: 0.0, y: 10.0, width: 100.0, height: 200.0)\n      }\n      ```\n    Available in iOS 8.0+  |  macOS 10.10+  |  tvOS 9.0+.\n  \n  - Remove all child view controllers:\n      ```swift\n      let parentViewCotroller = \u003cViewController initialization...\u003e\n  \n      let parentViewCotroller.removeChildViewControllers()\n      ```\n    Available in iOS 8.0+  |  macOS 10.10+  |  tvOS 9.0+.\n\n  \n  - Remove child view controller:\n      ```swift\n      let parentViewController = \u003cViewController initialization...\u003e\n      let childViewController = \u003cViewController initialization...\u003e\n    \n      parentViewController.removeChild(viewController: childViewController) {  \n      }\n      // Or.\n      childViewController.removeFromSuperViewController()\n      ```\n    Available in iOS 8.0+  |  macOS 10.10+  |  tvOS 9.0+.\n\n#### Foundation:\n\n##### - Classes:\n  - ```Cache``` is convenience wrapper of stanard Foundation ```NSCache``` class. ```Cache``` corresponds easy way to access\n    to cached value through subscript:\n      ```swift\n      let cache = \u003cCache intialization ...\u003e\n      let value = cache[\"key\"]\n      ```\n    Or we can cache the value using same subscript:\n      ```swift\n      let cache = \u003cCache intialization ...\u003e\n      let anyObjectValue = \u003cAny object value intialization ...\u003e\n      cache[\"key\"] = anyObjectValue as! AnyObject\n      ```    \n    Available in iOS 8.0+  |  macOS 10.10+  |  watchOS 2.0+  |  tvOS 9.0+.\n    \n  - ```Result``` is the two value enum, intended to emulate two posible values to any operation - ```success``` or   \n    ```failure``` case:\n      ```swift\n      let result = .success(\u003csuccess value\u003e)\n      switch result {\n      case .success(let \u003csuccess value\u003e):\n         // Code to handle success case.\n      case .failure(_):\n      }\n      ```\n    Or failure ```case```:\n      ```swift\n      let result = .failure(\u003cerror value\u003e)\n      switch result {\n      case .success(_):\n      case .failure(let error):\n         // Code to handle failure case.\n      }\n      ```\n    Available in iOS 8.0+  |  macOS 10.10+  |  watchOS 2.0+  |  tvOS 9.0+.\n\n##### - Extensions:\n   ```Array``` extensions provides next opportunites:\n   - Easy way to concatenate two arrays using ```+``` or ```+=``` operations:\n       ```swift\n       let firstArray = \u003cArray initialization ...\u003e\n       let secondArray = \u003cArray initialization ...\u003e\n       let thirdArray = firstArray + secondArray\n       var fourthArray = \u003cArray initialization ...\u003e\n       fourthArray += thirdArray\n       ```\n     Available in iOS 8.0+  |  macOS 10.10+  |  watchOS 2.0+  |  tvOS 9.0+.\n\n   - Make an array containing the results of mapping the given closure over the sequence’s elements:\n       ```swift\n       let firstArray = [1, 2, 3]\n       let secondArray = firstArray.make {idx, firstArrayElement in\n         return firstArrayElement*2\n       }\n       // secondArray == [2, 4, 6]\n       ```\n     Available in iOS 8.0+  |  macOS 10.10+  |  watchOS 2.0+  |  tvOS 9.0+.\n       \n   - Iterate through all elements in an array:\n      ```swift\n      let array = [1, 2, 3]\n      array.enumerate {idx, element in \n         // idx is index of element in an array\n         // element of an array\n      }\n      ```\n     Available in iOS 8.0+  |  macOS 10.10+  |  watchOS 2.0+  |  tvOS 9.0+.\n\n   - Remove specified element:\n      ```swift\n      var array = [1, 2, 3]\n      array.remove(element: 2)\n      // array == [1, 3]\n      ```   \n     Available in iOS 8.0+  |  macOS 10.10+  |  watchOS 2.0+  |  tvOS 9.0+.\n\n   ```Dictionary``` extensions provides next opportunites:\n   - Compare two dictionaries:\n       ```swift\n       let firstDictionary = [\"key\": \"value\"]\n       let secondDictionary = [\"key\": \"value\"]\n       if firstDictionary == secondDictionary {\n         // True\n       }\n       ```\n     Available in iOS 8.0+  |  macOS 10.10+  |  watchOS 2.0+  |  tvOS 9.0+.\n\n   - Easy way to concatenate two dictionaries using ```+``` or ```+=``` operations:\n       ```swift\n       let firstDictionary = [\"key1\": \"value1\"]\n       let secondDictionary = [\"key2\": \"value2\"]\n       let thirdDictionary = firstDictionary + secondDictionary\n       // thirdDictionary == [\"key1\": \"value1\", \"key2\": \"value2\"]\n       \n       var fourthDictionary = [\"key3\": \"value3\"]\n       fourthDictionary += thirdDictionary\n       // fourthDictionary == [\"key1\": \"value1\", \"key2\": \"value2\", \"key3\": \"value3\"]\n       ```\n     Available in iOS 8.0+  |  macOS 10.10+  |  watchOS 2.0+  |  tvOS 9.0+.\n       \n       \n   - Make a dictionary containing the results of mapping the given closure over the sequence’s elements:\n       ```swift\n       let firstDictionary = [\"key1\": \"value1\"]\n       let resultDictionary = firstDictionary.make {key, value in\n         retrun [\"result_key\": value]\n       }       \n       // resultDictionary == [\"result_key\": \"value1\"]\n       ```\n     Available in iOS 8.0+  |  macOS 10.10+  |  watchOS 2.0+  |  tvOS 9.0+.\n\n   - Iterate through all elements in a dictionary:\n       ```swift\n       let dictionary = [\"key1\": \"value1\"]\n       dictionary.enumerate {key, value in\n         // key == \"key1\"\n         // value == \"value1\"\n       }\n       ```\n     Available in iOS 8.0+  |  macOS 10.10+  |  watchOS 2.0+  |  tvOS 9.0+.\n      \n   - Get all keys and values of a dictionary:\n       ```swift\n       let dictionary = [\"key1\": \"value1\", \"key2\": \"value2\"]\n       let keys = dictionary.keys\n       let values = dictionary.values\n       // keys == [\"key1\", \"key2\"]\n       // values == [\"value1\", \"value2\"]\n       ```\n     Available in iOS 8.0+  |  macOS 10.10+  |  watchOS 2.0+  |  tvOS 9.0+.\n\n  ```Double``` extensions provides opportunity to generate random double numbers:\n  ```swift\n  let randomNumberInRange = Double.random(min: 0.0, max: 10.0)\n  let random = Double.random\n  let randomSign = Double.randomSign\n      \n  // randomNumberInRange will be equal to number in range between 0.0 and 10.0 inclusive.\n  // random will be equal to number in range between 0.0 and 1.0 inclusive.\n  // randomSign will be equal to number 1.0 or -1.0.\n  ```\n  Available in iOS 8.0+  |  macOS 10.10+  |  watchOS 2.0+  |  tvOS 9.0+.\n\n  ```Float``` extensions provides opportunity to generate random float numbers:\n  ```swift\n  let randomNumberInRange = Float.random(min: 0.0, max: 10.0)\n  let random = Float.random\n  let randomSign = Float.randomSign\n      \n  // randomNumberInRange will be equal to number in range between 0.0 and 10.0 inclusive.\n  // random will be equal to number in range between 0.0 and 1.0 inclusive.\n  // randomSign will be equal to number 1.0 or -1.0.\n  ```\n  Available in iOS 8.0+  |  macOS 10.10+  |  watchOS 2.0+  |  tvOS 9.0+.\n\n  ```Int``` extensions provides opportunity to generate random int numbers:\n  ```swift\n  let randomNumberInRange = Float.random(min: 0.0, max: 10.0)\n  let random = Float.random\n  let randomSign = Float.randomSign\n      \n  // randomNumberInRange will be equal to number in range between 0.0 and 10.0 inclusive.\n  // random will be equal to number in range between 0.0 and 1.0 inclusive.\n  // randomSign will be equal to number 1.0 or -1.0.\n  ```\n  Available in iOS 8.0+  |  macOS 10.10+  |  watchOS 2.0+  |  tvOS 9.0+.\n\n  ```NotificationCenter``` extensions provides opportunity to add an entry to the receiver’s dispatch table with a block   \n   to add to the current queue:\n  ```swift\n  let token = NotificationCenter.default.addObserver(forName: NotificationName) {notification -\u003e Void in\n      // Performs on the current queue. When specified notification performs.\n  }\n  NotificationCenter.default.removeObserver(token)\n  ``` \n  Available in iOS 8.0+  | macOS 10.10+  |  watchOS 2.0+  |  tvOS 9.0+.\n  \n  ```NSNumber``` extensions provides opportunity to check, whether stored value is bool or not:\n  ```swift\n  let number = NSNumber(value: true)\n  if number.isBool {\n      // true\n  }\n  ```\n  Available in iOS 8.0+  |  macOS 10.10+  |  watchOS 2.0+  |  tvOS 9.0+.\n  \n  ```OperationQueue``` extensions provides next opportunities:\n  - Convenience way to perform code synchronously / asynchronous on the main queue:\n      ```swift\n      PerformOnMainThreadSync {\n         // Code to perform synchronously on the main queue.\n      }\n      \n      PerformOnMainThreadAsync {\n         // Code to perform asynchronous on the main queue.\n      }\n      ```\n    Available in iOS 8.0+  |  macOS 10.10+  |  watchOS 2.0+  |  tvOS 9.0+.\n\n  - Convenience way to perform code synchronously / asynchronous on the background queue:\n      ```swift\n      PerformOnBackgroundThreadSync {\n         // Code to perform synchronously on the background queue.\n      }\n      \n      PerformOnBackgroundThreadAsync {\n         // Code to perform asynchronous on the background queue.\n      }\n      ```\n    Available in iOS 8.0+  |  macOS 10.10+  |  watchOS 2.0+  |  tvOS 9.0+.\n    \n  ```String``` extensions provides next opportunities:\n  - Convenience way to convert string object to ```Int```, ```UInt``` or ```NSString```:\n      ```swift\n      let intString = \"-10\"\n      let intValue = intString.int!\n      // intValue == -10\n      \n      let uintString = \"123\"\n      let uintValue = uintString.uint\n      // uintValue == 123\n      \n      let string = \"qwerty\"\n      let nsstring = string.ns_string\n      // nsstring.isEqual(to: \"qwerty\") \n      ```\n    Available in iOS 8.0+  |  macOS 10.10+  |  watchOS 2.0+  |  tvOS 9.0+.\n    \n  - Generate random string:\n      ```swift\n      let randomStringWithStandardAlphabet = String.random(wihtLength: 7)\n      // randomStringWithStandardAlphabet.characters.count == 7\n      // randomStringWithStandardAlphabet contains characters only from \n      // \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\" string\n      \n      let randomStringWithSpecifiedAlphabet = String.random(wihtLength: 10, fromLetters: \"123456789\")\n      // randomStringWithSpecifiedAlphabet.characters.count == 10\n      // randomStringWithSpecifiedAlphabet contains characters only from \"123456789\"\n      ```\n    Available in iOS 8.0+  |  macOS 10.10+  |  watchOS 2.0+  |  tvOS 9.0+.\n    \n  - Convenience way to get string length:\n      ```swift\n      let string = \"qwerty\"\n      let length = string.length\n      // length == 6\n      ```\n    Available in iOS 8.0+  |  macOS 10.10+  |  watchOS 2.0+  |  tvOS 9.0+.\n\n  - Convenience way to get url encode / decode string:\n      ```swift\n      let string = \"Lorem ipsum dolor sit amet, \"\n      let urlEncodedString = string.URLEncodedString\n      // urlEncodedString == \"Lorem%20ipsum%20dolor%20sit%20amet,%20\"\n      \n      let urlDecodedString = urlEncodedString.URLDecodedString\n      // urlDecodedString == \"Lorem ipsum dolor sit amet, \"\n      ```\n    Available in iOS 8.0+  |  macOS 10.10+  |  watchOS 2.0+  |  tvOS 9.0+.\n    \n  ```Timer``` extensions provides next opportunities:\n  - Convenience way to schedule timer:\n      ```swift\n      _ = Timer.schedule(delay: 5.0) {timer in\n         // Performs only once after 5.0 seconds delay\n      }\n      \n      _ = Timer.schedule(repeatInterval: 2.0) {timer in\n         // Performs every 2.0 seconds.\n      }\n      ```\n    Available in iOS 8.0+  |  macOS 10.10+  |  watchOS 2.0+  |  tvOS 9.0+.\n  \n  ```UserDefaults``` provides next opportunities:\n  - Store NSCoding objects:\n      ```swift\n      let object = \u003cNSCoding object initialization ...\u003e\n      UserDefaults.standard.set(object, forKey: \"key\")\n      ```\n    Available in iOS 8.0+  |  macOS 10.10+  |  watchOS 2.0+  |  tvOS 9.0+.\n    \n  - Sets / returns the value using subscript:\n      ```swift\n      let value = \"value\"\n      UserDefaults.standard[\"key\"] = value\n      \n      let storedValue = UserDefaults.standard[\"key\"]\n      // value == storedValue\n      ```\n    Available in iOS 8.0+  |  macOS 10.10+  |  watchOS 2.0+  |  tvOS 9.0+.\n\n\n   \n\n  \n  \n \n   \n  \n      \n  \n\n\n\n\n  \n  \n\n  \n  \n  \n\n  \n  \n  \n  \n  \n  \n\n  \n  \n  \n\n  \n   \n\n   \n   \n   \n   \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamonthecricket%2Fmy-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdamonthecricket%2Fmy-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamonthecricket%2Fmy-utils/lists"}