IOS-1455 collection from mm IOS-1455
authorXavier Algarra <xavier@pep-project.org>
Tue, 12 Feb 2019 12:19:16 +0100
branchIOS-1455
changeset 7613ba69967473eb
parent 7612 d5f2b11b810d
child 7616 0ed2059a0f71
IOS-1455 collection from mm
pEpUtilities/pEpUtilities/pEpUtilities.xcodeproj/project.pbxproj
pEpUtilities/pEpUtilities/pEpUtilities/UIKit/Collection+Extensions.swift
     1.1 --- a/pEpUtilities/pEpUtilities/pEpUtilities.xcodeproj/project.pbxproj	Tue Feb 12 12:12:48 2019 +0100
     1.2 +++ b/pEpUtilities/pEpUtilities/pEpUtilities.xcodeproj/project.pbxproj	Tue Feb 12 12:19:16 2019 +0100
     1.3 @@ -26,6 +26,7 @@
     1.4  		B75390802212DD0600B1FCF9 /* UIView+Util.swift in Sources */ = {isa = PBXBuildFile; fileRef = B753907F2212DD0600B1FCF9 /* UIView+Util.swift */; };
     1.5  		B75390822212DFB600B1FCF9 /* UINavigationController+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B75390812212DFB500B1FCF9 /* UINavigationController+Extensions.swift */; };
     1.6  		B75390842212DFD800B1FCF9 /* UIView+Autolayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = B75390832212DFD800B1FCF9 /* UIView+Autolayout.swift */; };
     1.7 +		B75390862212E20500B1FCF9 /* Collection+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B75390852212E20500B1FCF9 /* Collection+Extensions.swift */; };
     1.8  		B7911EC221F8694100D7F66F /* UIColor+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7911EC121F8694000D7F66F /* UIColor+Extension.swift */; };
     1.9  		B7911EC621F88AF800D7F66F /* UIImage+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7911EC521F88AF800D7F66F /* UIImage+Extension.swift */; };
    1.10  		B7911EC821F88D0200D7F66F /* UITextField+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7911EC721F88D0200D7F66F /* UITextField+Extension.swift */; };
    1.11 @@ -61,6 +62,7 @@
    1.12  		B753907F2212DD0600B1FCF9 /* UIView+Util.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Util.swift"; sourceTree = "<group>"; };
    1.13  		B75390812212DFB500B1FCF9 /* UINavigationController+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UINavigationController+Extensions.swift"; sourceTree = "<group>"; };
    1.14  		B75390832212DFD800B1FCF9 /* UIView+Autolayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Autolayout.swift"; sourceTree = "<group>"; };
    1.15 +		B75390852212E20500B1FCF9 /* Collection+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Collection+Extensions.swift"; sourceTree = "<group>"; };
    1.16  		B7911EB421F7358500D7F66F /* pEpUtilities.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = pEpUtilities.framework; sourceTree = BUILT_PRODUCTS_DIR; };
    1.17  		B7911EB821F7358500D7F66F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
    1.18  		B7911EC121F8694000D7F66F /* UIColor+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIColor+Extension.swift"; sourceTree = "<group>"; };
    1.19 @@ -130,6 +132,7 @@
    1.20  				B753907F2212DD0600B1FCF9 /* UIView+Util.swift */,
    1.21  				B75390832212DFD800B1FCF9 /* UIView+Autolayout.swift */,
    1.22  				B75390812212DFB500B1FCF9 /* UINavigationController+Extensions.swift */,
    1.23 +				B75390852212E20500B1FCF9 /* Collection+Extensions.swift */,
    1.24  			);
    1.25  			path = UIKit;
    1.26  			sourceTree = "<group>";
    1.27 @@ -260,6 +263,7 @@
    1.28  				B7465DDF2211C6C8008A1708 /* UIBarButtonItem+Extension.swift in Sources */,
    1.29  				B7936E3D220DD8F5003B39E6 /* NSAttributedString+Extensions.swift in Sources */,
    1.30  				B75390842212DFD800B1FCF9 /* UIView+Autolayout.swift in Sources */,
    1.31 +				B75390862212E20500B1FCF9 /* Collection+Extensions.swift in Sources */,
    1.32  				B7465DE92212CCDB008A1708 /* UIButton+Extension.swift in Sources */,
    1.33  				B7911EC221F8694100D7F66F /* UIColor+Extension.swift in Sources */,
    1.34  				B753907E2212D6B500B1FCF9 /* CGSize+Extension.swift in Sources */,
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/pEpUtilities/pEpUtilities/pEpUtilities/UIKit/Collection+Extensions.swift	Tue Feb 12 12:19:16 2019 +0100
     2.3 @@ -0,0 +1,18 @@
     2.4 +//
     2.5 +//  Collection+Extensions.swift
     2.6 +//  MessageModel
     2.7 +//
     2.8 +//  Created by Dirk Zimmermann on 11/10/16.
     2.9 +//  Copyright © 2016 pEp Security S.A. All rights reserved.
    2.10 +//
    2.11 +
    2.12 +import UIKit
    2.13 +
    2.14 +extension Collection {
    2.15 +    /*
    2.16 +     * Returns the element at the specified index if it is within bounds, otherwise nil.
    2.17 +     */
    2.18 +    public subscript(safe index: Index) -> Iterator.Element? {
    2.19 +        return index >= startIndex && index < endIndex ? self[index] : nil
    2.20 +    }
    2.21 +}