Skip to content

SafeArray is a wrapper on a Swift Array which provides thread-safe access to the Array elements.

License

Notifications You must be signed in to change notification settings

engel88/SafeArray

 
 

Repository files navigation

SafeArray

[CI Status](https://travis-ci.org/Pete Smith/SafeArray) Version License Platform

SafeArray

SafeArray is a wrapper on a Swift Array which provides thread-safe access to it's underlying Array elements.

Thread-safe versions Array/Collection methods such as append, map are provided.

Examples

Creating a SafeArray

let safeArray = SafeArray<Int>(withElements: [1,2,3]])

Appending elements

var safeArray = SafeArray<Int>(withElements: [1,2,3]])
safeArray.append(contentsOf: [4,5])

Map

let safeArray = SafeArray<String>(withElements: ["world1","world2"])        
let mappedArray = safeArray.map { "Hello "+$0 }

Filter

let safeArray = SafeArray<Int>(withElements: [1,2,3])
let filteredArray = safeArray.filter { $0 != 1 }

Requirements

iOS 9

Installation

SafeArray is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "SafeArray"

Author

Pete Smith, [email protected]

License

SafeArray is available under the MIT license. See the LICENSE file for more info.

About

SafeArray is a wrapper on a Swift Array which provides thread-safe access to the Array elements.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 85.2%
  • Ruby 14.8%