SafeArray is a wrapper on a Swift Array which provides thread-safe access to the Array elements.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Example
SafeArray
.gitattributes
.gitignore
.travis.yml
LICENSE
README.md
SafeArray.podspec
_Pods.xcodeproj

README.md

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, peadar81@gmail.com

License

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