Skip to content

Commit

Permalink
First examples of documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Esqarrouth committed Dec 28, 2015
1 parent 53ef2d9 commit c8ed6e3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Sources/ArrayExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
import UIKit

extension Array {
/// EZSwiftExtensions

/// EZSE: Returns a random element from the array.
public func random() -> Element {
let index = Int(arc4random_uniform(UInt32(self.count)))
return self[index]
}

/// EZSwiftExtensions
/// EZSE: EZSE: Returns the index of the object
public func indexOfObject<T: Equatable>(object: T) -> Int? {
for index in 0..<self.count {
if let arrayObject = self[index] as? T {
Expand All @@ -24,11 +24,11 @@ extension Array {
}
}
}

return nil
}

/// EZSwiftExtensions
/// EZSE: Removes the last given object
public mutating func removeObject<U: Equatable>(object: U) {
for i in (0..<count).reverse() {
if let obj = self[i] as? U where obj == object {
Expand All @@ -38,7 +38,7 @@ extension Array {
}
}

/// EZSwiftExtensions
/// EZSE: Removes all occurrences of the given object
public mutating func removeObjects<U: Equatable>(object: U) {
for i in (0..<count).reverse() {
if let obj = self[i] as? U where obj == object {
Expand All @@ -50,7 +50,7 @@ extension Array {

extension Array where Element : Equatable {

/// EZSwiftExtensions
/// EZSE: Checks if the main array contains the parameter array
public func arrayContainsArray(lookFor: [Element]) -> Bool {
for item in lookFor {
if self.contains(item) == false {
Expand Down

0 comments on commit c8ed6e3

Please sign in to comment.