Repository: RuiAAPeres/OptionalExtensions Branch: master Commit: bcfd2298a714 Files: 21 Total size: 70.5 KB Directory structure: gitextract_zqi2r2wa/ ├── .gitignore ├── .swift-version ├── .travis.yml ├── LICENSE ├── OptionalExtensions/ │ ├── Source/ │ │ └── OptionalExtensions.swift │ └── Support/ │ └── Info.plist ├── OptionalExtensions.playground/ │ ├── Contents.swift │ ├── contents.xcplayground │ └── timeline.xctimeline ├── OptionalExtensions.podspec ├── OptionalExtensions.xcodeproj/ │ ├── project.pbxproj │ ├── project.xcworkspace/ │ │ └── contents.xcworkspacedata │ └── xcshareddata/ │ └── xcschemes/ │ ├── OptionalExtensions-Mac.xcscheme │ ├── OptionalExtensions-iOS-Tests.xcscheme │ ├── OptionalExtensions-iOS.xcscheme │ ├── OptionalExtensions-tvOS.xcscheme │ └── OptionalExtensions-watchOS.xcscheme ├── OptionalExtensions.xcworkspace/ │ └── contents.xcworkspacedata ├── OptionalExtensionsTests/ │ ├── Info.plist │ └── OptionalExtensionsTests.swift └── README.md ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ # Xcode # # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore ## Build generated build/ DerivedData ## Various settings *.pbxuser !default.pbxuser *.mode1v3 !default.mode1v3 *.mode2v3 !default.mode2v3 *.perspectivev3 !default.perspectivev3 xcuserdata ## Other *.xccheckout *.moved-aside *.xcuserstate *.xcscmblueprint ## Obj-C/Swift specific *.hmap *.ipa # Swift Package Manager # # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. # Packages/ .build/ # CocoaPods # # We recommend against adding the Pods directory to your .gitignore. However # you should judge for yourself, the pros and cons are mentioned at: # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control # # Pods/ # Carthage # # Add this line if you want to avoid checking in source code from Carthage dependencies. # Carthage/Checkouts Carthage/Build # fastlane # # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the # screenshots whenever they are needed. # For more information about the recommended setup visit: # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md fastlane/report.xml fastlane/screenshots ================================================ FILE: .swift-version ================================================ 4.0 ================================================ FILE: .travis.yml ================================================ language: objective-c osx_image: xcode9 script: - set -o pipefail - xcodebuild test -scheme OptionalExtensions-Mac | xcpretty -c - xcodebuild test -scheme OptionalExtensions-iOS -sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 6s" | xcpretty -c - xcodebuild test -scheme OptionalExtensions-tvOS -sdk appletvsimulator -destination "platform=tvOS Simulator,name=Apple TV 1080p" | xcpretty -c - xcodebuild build -scheme OptionalExtensions-watchOS -sdk watchsimulator -destination "platform=watchOS Simulator,name=Apple Watch - 38mm" | xcpretty -c ================================================ FILE: LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Rui Peres Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: OptionalExtensions/Source/OptionalExtensions.swift ================================================ // // OptionalExtensions.swift // OptionalExtensions // // Created by Rui Peres on 30/12/2015. // Copyright © 2015 Rui Peres. All rights reserved. // public extension Optional { func filter(_ predicate: (Wrapped) -> Bool) -> Optional { return map(predicate) == .some(true) ? self : .none } func mapNil(_ predicate: () -> Wrapped) -> Optional { return self ?? .some(predicate()) } func flatMapNil(_ predicate: () -> Optional) -> Optional { return self ?? predicate() } func then(_ f: (Wrapped) -> Void) { if let wrapped = self { f(wrapped) } } func maybe(_ defaultValue: U, f: (Wrapped) -> U) -> U { return map(f) ?? defaultValue } func onSome(_ f: (Wrapped) -> Void) -> Optional { then(f) return self } func onNone(_ f: () -> Void) -> Optional { if isNone { f() } return self } var isSome: Bool { return self != nil } var isNone: Bool { return !isSome } } ================================================ FILE: OptionalExtensions/Support/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType FMWK CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass ================================================ FILE: OptionalExtensions.playground/Contents.swift ================================================ //: Playground - noun: a place where people can play import OptionalExtensions ================================================ FILE: OptionalExtensions.playground/contents.xcplayground ================================================ ================================================ FILE: OptionalExtensions.playground/timeline.xctimeline ================================================ ================================================ FILE: OptionalExtensions.podspec ================================================ Pod::Spec.new do |s| s.name = "OptionalExtensions" s.version = "3.0" s.summary = "Swift µframework with extensions for the Optional Type" s.description = <<-EOS Swift's Optional is pretty awesome, but it can always get better. This repository is an humble attempt to add some utility methods to it. EOS s.homepage = "https://github.com/RuiAAPeres/OptionalExtensions" s.license = "MIT" s.author = "Rui Peres" s.social_media_url = "https://twitter.com/peres" s.source = { :git => "https://github.com/RuiAAPeres/OptionalExtensions.git", :tag => s.version.to_s } s.ios.deployment_target = "8.0" s.osx.deployment_target = "10.10" s.tvos.deployment_target = "9.0" s.watchos.deployment_target = "2.0" s.source_files = "OptionalExtensions/Source/*" end ================================================ FILE: OptionalExtensions.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 7DA053601C3DC5F3001F27B2 /* OptionalExtensions.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C7263FD81C3C6D1000F402F9 /* OptionalExtensions.framework */; }; 7DA053661C3DC627001F27B2 /* OptionalExtensionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7120AB01C348DE700867028 /* OptionalExtensionsTests.swift */; }; 7DA053701C3DC675001F27B2 /* OptionalExtensions.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C7263FCA1C3C6C9E00F402F9 /* OptionalExtensions.framework */; }; 7DA053761C3DC699001F27B2 /* OptionalExtensionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7120AB01C348DE700867028 /* OptionalExtensionsTests.swift */; }; C7263FC41C3C6C2F00F402F9 /* OptionalExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7EC1DD11C3450A200BA1261 /* OptionalExtensions.swift */; }; C7263FD21C3C6CE100F402F9 /* OptionalExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7EC1DD11C3450A200BA1261 /* OptionalExtensions.swift */; }; C7263FE01C3C6D2700F402F9 /* OptionalExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7EC1DD11C3450A200BA1261 /* OptionalExtensions.swift */; }; C7EC1DD21C3450A200BA1261 /* OptionalExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7EC1DD11C3450A200BA1261 /* OptionalExtensions.swift */; }; E7120AB11C348DE700867028 /* OptionalExtensionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7120AB01C348DE700867028 /* OptionalExtensionsTests.swift */; }; E7120AB31C348DE700867028 /* OptionalExtensions.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C7EC1DC41C34503A00BA1261 /* OptionalExtensions.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ 7DA053611C3DC5F3001F27B2 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C7EC1DBB1C34503A00BA1261 /* Project object */; proxyType = 1; remoteGlobalIDString = C7263FD71C3C6D1000F402F9; remoteInfo = "OptionalExtensions Mac"; }; 7DA053711C3DC675001F27B2 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C7EC1DBB1C34503A00BA1261 /* Project object */; proxyType = 1; remoteGlobalIDString = C7263FC91C3C6C9E00F402F9; remoteInfo = "OptionalExtensions tvOS"; }; E7120AB41C348DE700867028 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C7EC1DBB1C34503A00BA1261 /* Project object */; proxyType = 1; remoteGlobalIDString = C7EC1DC31C34503A00BA1261; remoteInfo = OptionalExtensions; }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ 7DA0535B1C3DC5F3001F27B2 /* OptionalExtensions Mac Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "OptionalExtensions Mac Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 7DA0536B1C3DC675001F27B2 /* OptionalExtensions tvOS Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "OptionalExtensions tvOS Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; C7263FBC1C3C6BB200F402F9 /* OptionalExtensions.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OptionalExtensions.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C7263FCA1C3C6C9E00F402F9 /* OptionalExtensions.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OptionalExtensions.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C7263FD81C3C6D1000F402F9 /* OptionalExtensions.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OptionalExtensions.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C77934771C41E79E00A7DAB7 /* OptionalExtensions.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = OptionalExtensions.playground; sourceTree = ""; }; C7EC1DC41C34503A00BA1261 /* OptionalExtensions.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OptionalExtensions.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C7EC1DD11C3450A200BA1261 /* OptionalExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OptionalExtensions.swift; sourceTree = ""; }; C7EC1DD41C345DD900BA1261 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; E7120AAE1C348DE600867028 /* OptionalExtensions iOS Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "OptionalExtensions iOS Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; E7120AB01C348DE700867028 /* OptionalExtensionsTests.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = OptionalExtensionsTests.swift; sourceTree = ""; tabWidth = 4; }; E7120AB21C348DE700867028 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 7DA053581C3DC5F3001F27B2 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 7DA053601C3DC5F3001F27B2 /* OptionalExtensions.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; 7DA053681C3DC675001F27B2 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 7DA053701C3DC675001F27B2 /* OptionalExtensions.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; C7263FB81C3C6BB200F402F9 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C7263FC61C3C6C9E00F402F9 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C7263FD41C3C6D1000F402F9 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C7EC1DC01C34503A00BA1261 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; E7120AAB1C348DE600867028 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( E7120AB31C348DE700867028 /* OptionalExtensions.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ C7EC1DBA1C34503A00BA1261 = { isa = PBXGroup; children = ( C77934771C41E79E00A7DAB7 /* OptionalExtensions.playground */, C7EC1DC61C34503A00BA1261 /* OptionalExtensions */, E7120AAF1C348DE700867028 /* OptionalExtensionsTests */, C7EC1DC51C34503A00BA1261 /* Products */, ); indentWidth = 4; sourceTree = ""; tabWidth = 4; }; C7EC1DC51C34503A00BA1261 /* Products */ = { isa = PBXGroup; children = ( C7EC1DC41C34503A00BA1261 /* OptionalExtensions.framework */, E7120AAE1C348DE600867028 /* OptionalExtensions iOS Tests.xctest */, C7263FBC1C3C6BB200F402F9 /* OptionalExtensions.framework */, C7263FCA1C3C6C9E00F402F9 /* OptionalExtensions.framework */, C7263FD81C3C6D1000F402F9 /* OptionalExtensions.framework */, 7DA0535B1C3DC5F3001F27B2 /* OptionalExtensions Mac Tests.xctest */, 7DA0536B1C3DC675001F27B2 /* OptionalExtensions tvOS Tests.xctest */, ); name = Products; sourceTree = ""; }; C7EC1DC61C34503A00BA1261 /* OptionalExtensions */ = { isa = PBXGroup; children = ( C7EC1DD31C345DD900BA1261 /* Support */, C7EC1DD01C34509A00BA1261 /* Source */, ); path = OptionalExtensions; sourceTree = ""; }; C7EC1DD01C34509A00BA1261 /* Source */ = { isa = PBXGroup; children = ( C7EC1DD11C3450A200BA1261 /* OptionalExtensions.swift */, ); path = Source; sourceTree = ""; }; C7EC1DD31C345DD900BA1261 /* Support */ = { isa = PBXGroup; children = ( C7EC1DD41C345DD900BA1261 /* Info.plist */, ); path = Support; sourceTree = ""; }; E7120AAF1C348DE700867028 /* OptionalExtensionsTests */ = { isa = PBXGroup; children = ( E7120AB01C348DE700867028 /* OptionalExtensionsTests.swift */, E7120AB21C348DE700867028 /* Info.plist */, ); path = OptionalExtensionsTests; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ C7263FB91C3C6BB200F402F9 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C7263FC71C3C6C9E00F402F9 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C7263FD51C3C6D1000F402F9 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C7EC1DC11C34503A00BA1261 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ 7DA0535A1C3DC5F3001F27B2 /* OptionalExtensions Mac Tests */ = { isa = PBXNativeTarget; buildConfigurationList = 7DA053651C3DC5F3001F27B2 /* Build configuration list for PBXNativeTarget "OptionalExtensions Mac Tests" */; buildPhases = ( 7DA053571C3DC5F3001F27B2 /* Sources */, 7DA053581C3DC5F3001F27B2 /* Frameworks */, 7DA053591C3DC5F3001F27B2 /* Resources */, ); buildRules = ( ); dependencies = ( 7DA053621C3DC5F3001F27B2 /* PBXTargetDependency */, ); name = "OptionalExtensions Mac Tests"; productName = "OptionalExtensions Mac Tests"; productReference = 7DA0535B1C3DC5F3001F27B2 /* OptionalExtensions Mac Tests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; 7DA0536A1C3DC675001F27B2 /* OptionalExtensions tvOS Tests */ = { isa = PBXNativeTarget; buildConfigurationList = 7DA053731C3DC675001F27B2 /* Build configuration list for PBXNativeTarget "OptionalExtensions tvOS Tests" */; buildPhases = ( 7DA053671C3DC675001F27B2 /* Sources */, 7DA053681C3DC675001F27B2 /* Frameworks */, 7DA053691C3DC675001F27B2 /* Resources */, ); buildRules = ( ); dependencies = ( 7DA053721C3DC675001F27B2 /* PBXTargetDependency */, ); name = "OptionalExtensions tvOS Tests"; productName = "OptionalExtensions tvOS Tests"; productReference = 7DA0536B1C3DC675001F27B2 /* OptionalExtensions tvOS Tests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; C7263FBB1C3C6BB200F402F9 /* OptionalExtensions watchOS */ = { isa = PBXNativeTarget; buildConfigurationList = C7263FC11C3C6BB200F402F9 /* Build configuration list for PBXNativeTarget "OptionalExtensions watchOS" */; buildPhases = ( C7263FB71C3C6BB200F402F9 /* Sources */, C7263FB81C3C6BB200F402F9 /* Frameworks */, C7263FB91C3C6BB200F402F9 /* Headers */, C7263FBA1C3C6BB200F402F9 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = "OptionalExtensions watchOS"; productName = "OptionalExtensions WatchOS"; productReference = C7263FBC1C3C6BB200F402F9 /* OptionalExtensions.framework */; productType = "com.apple.product-type.framework"; }; C7263FC91C3C6C9E00F402F9 /* OptionalExtensions tvOS */ = { isa = PBXNativeTarget; buildConfigurationList = C7263FCF1C3C6C9F00F402F9 /* Build configuration list for PBXNativeTarget "OptionalExtensions tvOS" */; buildPhases = ( C7263FC51C3C6C9E00F402F9 /* Sources */, C7263FC61C3C6C9E00F402F9 /* Frameworks */, C7263FC71C3C6C9E00F402F9 /* Headers */, C7263FC81C3C6C9E00F402F9 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = "OptionalExtensions tvOS"; productName = "OptionalExtensions tvOS"; productReference = C7263FCA1C3C6C9E00F402F9 /* OptionalExtensions.framework */; productType = "com.apple.product-type.framework"; }; C7263FD71C3C6D1000F402F9 /* OptionalExtensions Mac */ = { isa = PBXNativeTarget; buildConfigurationList = C7263FDD1C3C6D1100F402F9 /* Build configuration list for PBXNativeTarget "OptionalExtensions Mac" */; buildPhases = ( C7263FD31C3C6D1000F402F9 /* Sources */, C7263FD41C3C6D1000F402F9 /* Frameworks */, C7263FD51C3C6D1000F402F9 /* Headers */, C7263FD61C3C6D1000F402F9 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = "OptionalExtensions Mac"; productName = "OptionalExtensions Mac"; productReference = C7263FD81C3C6D1000F402F9 /* OptionalExtensions.framework */; productType = "com.apple.product-type.framework"; }; C7EC1DC31C34503A00BA1261 /* OptionalExtensions iOS */ = { isa = PBXNativeTarget; buildConfigurationList = C7EC1DCC1C34503A00BA1261 /* Build configuration list for PBXNativeTarget "OptionalExtensions iOS" */; buildPhases = ( C7EC1DBF1C34503A00BA1261 /* Sources */, C7EC1DC01C34503A00BA1261 /* Frameworks */, C7EC1DC11C34503A00BA1261 /* Headers */, C7EC1DC21C34503A00BA1261 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = "OptionalExtensions iOS"; productName = OptionalExtensions; productReference = C7EC1DC41C34503A00BA1261 /* OptionalExtensions.framework */; productType = "com.apple.product-type.framework"; }; E7120AAD1C348DE600867028 /* OptionalExtensions iOS Tests */ = { isa = PBXNativeTarget; buildConfigurationList = E7120AB81C348DE700867028 /* Build configuration list for PBXNativeTarget "OptionalExtensions iOS Tests" */; buildPhases = ( E7120AAA1C348DE600867028 /* Sources */, E7120AAB1C348DE600867028 /* Frameworks */, E7120AAC1C348DE600867028 /* Resources */, ); buildRules = ( ); dependencies = ( E7120AB51C348DE700867028 /* PBXTargetDependency */, ); name = "OptionalExtensions iOS Tests"; productName = OptionalExtensionsTests; productReference = E7120AAE1C348DE600867028 /* OptionalExtensions iOS Tests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ C7EC1DBB1C34503A00BA1261 /* Project object */ = { isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; LastUpgradeCheck = 0800; ORGANIZATIONNAME = "Rui Peres"; TargetAttributes = { 7DA0535A1C3DC5F3001F27B2 = { CreatedOnToolsVersion = 7.2; LastSwiftMigration = 0800; }; 7DA0536A1C3DC675001F27B2 = { CreatedOnToolsVersion = 7.2; LastSwiftMigration = 0800; }; C7263FBB1C3C6BB200F402F9 = { CreatedOnToolsVersion = 7.2; LastSwiftMigration = 0800; }; C7263FC91C3C6C9E00F402F9 = { CreatedOnToolsVersion = 7.2; LastSwiftMigration = 0800; }; C7263FD71C3C6D1000F402F9 = { CreatedOnToolsVersion = 7.2; LastSwiftMigration = 0800; }; C7EC1DC31C34503A00BA1261 = { CreatedOnToolsVersion = 7.2; LastSwiftMigration = 0800; }; E7120AAD1C348DE600867028 = { CreatedOnToolsVersion = 7.2; LastSwiftMigration = 0800; }; }; }; buildConfigurationList = C7EC1DBE1C34503A00BA1261 /* Build configuration list for PBXProject "OptionalExtensions" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = C7EC1DBA1C34503A00BA1261; productRefGroup = C7EC1DC51C34503A00BA1261 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( C7EC1DC31C34503A00BA1261 /* OptionalExtensions iOS */, E7120AAD1C348DE600867028 /* OptionalExtensions iOS Tests */, C7263FD71C3C6D1000F402F9 /* OptionalExtensions Mac */, 7DA0535A1C3DC5F3001F27B2 /* OptionalExtensions Mac Tests */, C7263FC91C3C6C9E00F402F9 /* OptionalExtensions tvOS */, 7DA0536A1C3DC675001F27B2 /* OptionalExtensions tvOS Tests */, C7263FBB1C3C6BB200F402F9 /* OptionalExtensions watchOS */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 7DA053591C3DC5F3001F27B2 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; 7DA053691C3DC675001F27B2 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C7263FBA1C3C6BB200F402F9 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C7263FC81C3C6C9E00F402F9 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C7263FD61C3C6D1000F402F9 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C7EC1DC21C34503A00BA1261 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; E7120AAC1C348DE600867028 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 7DA053571C3DC5F3001F27B2 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 7DA053661C3DC627001F27B2 /* OptionalExtensionsTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; 7DA053671C3DC675001F27B2 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 7DA053761C3DC699001F27B2 /* OptionalExtensionsTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; C7263FB71C3C6BB200F402F9 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( C7263FC41C3C6C2F00F402F9 /* OptionalExtensions.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; C7263FC51C3C6C9E00F402F9 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( C7263FD21C3C6CE100F402F9 /* OptionalExtensions.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; C7263FD31C3C6D1000F402F9 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( C7263FE01C3C6D2700F402F9 /* OptionalExtensions.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; C7EC1DBF1C34503A00BA1261 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( C7EC1DD21C3450A200BA1261 /* OptionalExtensions.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; E7120AAA1C348DE600867028 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( E7120AB11C348DE700867028 /* OptionalExtensionsTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ 7DA053621C3DC5F3001F27B2 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = C7263FD71C3C6D1000F402F9 /* OptionalExtensions Mac */; targetProxy = 7DA053611C3DC5F3001F27B2 /* PBXContainerItemProxy */; }; 7DA053721C3DC675001F27B2 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = C7263FC91C3C6C9E00F402F9 /* OptionalExtensions tvOS */; targetProxy = 7DA053711C3DC675001F27B2 /* PBXContainerItemProxy */; }; E7120AB51C348DE700867028 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = C7EC1DC31C34503A00BA1261 /* OptionalExtensions iOS */; targetProxy = E7120AB41C348DE700867028 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ 7DA053631C3DC5F3001F27B2 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = OptionalExtensionsTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.11; PRODUCT_BUNDLE_IDENTIFIER = "rp.OptionalExtensions-Mac-Tests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; SWIFT_VERSION = 3.0; }; name = Debug; }; 7DA053641C3DC5F3001F27B2 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = OptionalExtensionsTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.11; PRODUCT_BUNDLE_IDENTIFIER = "rp.OptionalExtensions-Mac-Tests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 3.0; }; name = Release; }; 7DA053741C3DC675001F27B2 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = OptionalExtensionsTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "rp.OptionalExtensions-tvOS-Tests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 9.1; }; name = Debug; }; 7DA053751C3DC675001F27B2 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = OptionalExtensionsTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "rp.OptionalExtensions-tvOS-Tests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 9.1; }; name = Release; }; C7263FC21C3C6BB200F402F9 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = OptionalExtensions/Support/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "rp.OptionalExtensions-watchOS"; PRODUCT_NAME = OptionalExtensions; SDKROOT = watchos; SKIP_INSTALL = YES; SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = 4; WATCHOS_DEPLOYMENT_TARGET = 2.0; }; name = Debug; }; C7263FC31C3C6BB200F402F9 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = OptionalExtensions/Support/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "rp.OptionalExtensions-watchOS"; PRODUCT_NAME = OptionalExtensions; SDKROOT = watchos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = 4; WATCHOS_DEPLOYMENT_TARGET = 2.0; }; name = Release; }; C7263FD01C3C6C9F00F402F9 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = OptionalExtensions/Support/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "rp.OptionalExtensions-tvOS"; PRODUCT_NAME = OptionalExtensions; SDKROOT = appletvos; SKIP_INSTALL = YES; SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; }; C7263FD11C3C6C9F00F402F9 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = OptionalExtensions/Support/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "rp.OptionalExtensions-tvOS"; PRODUCT_NAME = OptionalExtensions; SDKROOT = appletvos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Release; }; C7263FDE1C3C6D1100F402F9 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_VERSION = A; INFOPLIST_FILE = OptionalExtensions/Support/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.10; PRODUCT_BUNDLE_IDENTIFIER = "rp.OptionalExtensions-Mac"; PRODUCT_NAME = OptionalExtensions; SDKROOT = macosx; SKIP_INSTALL = YES; SWIFT_VERSION = 3.0; }; name = Debug; }; C7263FDF1C3C6D1100F402F9 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_VERSION = A; INFOPLIST_FILE = OptionalExtensions/Support/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.10; PRODUCT_BUNDLE_IDENTIFIER = "rp.OptionalExtensions-Mac"; PRODUCT_NAME = OptionalExtensions; SDKROOT = macosx; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 3.0; }; name = Release; }; C7EC1DCA1C34503A00BA1261 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; name = Debug; }; C7EC1DCB1C34503A00BA1261 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; name = Release; }; C7EC1DCD1C34503A00BA1261 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = OptionalExtensions/Support/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "rp.OptionalExtensions-iOS"; PRODUCT_NAME = OptionalExtensions; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 4.0; }; name = Debug; }; C7EC1DCE1C34503A00BA1261 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = OptionalExtensions/Support/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "rp.OptionalExtensions-iOS"; PRODUCT_NAME = OptionalExtensions; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 4.0; }; name = Release; }; E7120AB61C348DE700867028 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = OptionalExtensionsTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "rp.OptionalExtensions-iOS-Tests"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 3.0; }; name = Debug; }; E7120AB71C348DE700867028 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = OptionalExtensionsTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "rp.OptionalExtensions-iOS-Tests"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 3.0; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 7DA053651C3DC5F3001F27B2 /* Build configuration list for PBXNativeTarget "OptionalExtensions Mac Tests" */ = { isa = XCConfigurationList; buildConfigurations = ( 7DA053631C3DC5F3001F27B2 /* Debug */, 7DA053641C3DC5F3001F27B2 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 7DA053731C3DC675001F27B2 /* Build configuration list for PBXNativeTarget "OptionalExtensions tvOS Tests" */ = { isa = XCConfigurationList; buildConfigurations = ( 7DA053741C3DC675001F27B2 /* Debug */, 7DA053751C3DC675001F27B2 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C7263FC11C3C6BB200F402F9 /* Build configuration list for PBXNativeTarget "OptionalExtensions watchOS" */ = { isa = XCConfigurationList; buildConfigurations = ( C7263FC21C3C6BB200F402F9 /* Debug */, C7263FC31C3C6BB200F402F9 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C7263FCF1C3C6C9F00F402F9 /* Build configuration list for PBXNativeTarget "OptionalExtensions tvOS" */ = { isa = XCConfigurationList; buildConfigurations = ( C7263FD01C3C6C9F00F402F9 /* Debug */, C7263FD11C3C6C9F00F402F9 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C7263FDD1C3C6D1100F402F9 /* Build configuration list for PBXNativeTarget "OptionalExtensions Mac" */ = { isa = XCConfigurationList; buildConfigurations = ( C7263FDE1C3C6D1100F402F9 /* Debug */, C7263FDF1C3C6D1100F402F9 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C7EC1DBE1C34503A00BA1261 /* Build configuration list for PBXProject "OptionalExtensions" */ = { isa = XCConfigurationList; buildConfigurations = ( C7EC1DCA1C34503A00BA1261 /* Debug */, C7EC1DCB1C34503A00BA1261 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C7EC1DCC1C34503A00BA1261 /* Build configuration list for PBXNativeTarget "OptionalExtensions iOS" */ = { isa = XCConfigurationList; buildConfigurations = ( C7EC1DCD1C34503A00BA1261 /* Debug */, C7EC1DCE1C34503A00BA1261 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; E7120AB81C348DE700867028 /* Build configuration list for PBXNativeTarget "OptionalExtensions iOS Tests" */ = { isa = XCConfigurationList; buildConfigurations = ( E7120AB61C348DE700867028 /* Debug */, E7120AB71C348DE700867028 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = C7EC1DBB1C34503A00BA1261 /* Project object */; } ================================================ FILE: OptionalExtensions.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: OptionalExtensions.xcodeproj/xcshareddata/xcschemes/OptionalExtensions-Mac.xcscheme ================================================ ================================================ FILE: OptionalExtensions.xcodeproj/xcshareddata/xcschemes/OptionalExtensions-iOS-Tests.xcscheme ================================================ ================================================ FILE: OptionalExtensions.xcodeproj/xcshareddata/xcschemes/OptionalExtensions-iOS.xcscheme ================================================ ================================================ FILE: OptionalExtensions.xcodeproj/xcshareddata/xcschemes/OptionalExtensions-tvOS.xcscheme ================================================ ================================================ FILE: OptionalExtensions.xcodeproj/xcshareddata/xcschemes/OptionalExtensions-watchOS.xcscheme ================================================ ================================================ FILE: OptionalExtensions.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: OptionalExtensionsTests/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType BNDL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 ================================================ FILE: OptionalExtensionsTests/OptionalExtensionsTests.swift ================================================ // // OptionalExtensionsTests.swift // OptionalExtensionsTests // // Created by Alan Skipp on 30/12/2015. // Copyright © 2015 Rui Peres. All rights reserved. // import XCTest import OptionalExtensions class OptionalExtensionsTests: XCTestCase { // MARK: - filter func test_filter_whenPredicateMatches_thenReturnsOptionalValue() { // given let number: Int? = 3 // when let result = number.filter { $0 > 2 } // then XCTAssertEqual(result, 3) } func test_filter_whenPredicateDoesNotMatch_thenReturnsNil() { // given let number: Int? = 3 // when let result = number.filter { $0 > 3 } // then XCTAssertNil(result) } // MARK: - mapNil func test_mapNil_whenInvokedWithNonNil_thenReturnsOriginalValue() { // given let number: Int? = 3 // when let result = number.mapNil { 5 } // then XCTAssertEqual(result, 3) } func test_mapNil_whenInvokedWithNil_thenReturnsReplacedValue() { // given let nilledNumber: Int? = nil // when let result = nilledNumber.mapNil { 5 } // then XCTAssertEqual(result, 5) } // MARK: - flatMapNil func test_flatMapNil_whenInvokedWithNonNil_thenReturnsOriginalValue() { // given let number: Int? = 3 // when let result = number.flatMapNil { .some(2) } // then XCTAssertEqual(result, .some(3)) } func test_flatMapNil_whenInvokedWithNil_thenReturnsReplacedValue() { // given let nilledNumber: Int? = nil // when let result = nilledNumber.flatMapNil { .some(2) } // then XCTAssertEqual(result, .some(2)) } // MARK: - then func test_then_whenInvokedOnNonNilValue_thenOperationIsInvoked() { // given var testInt = 0 let nonNilledNumber: Int? = 3 // when nonNilledNumber.then { _ in testInt = 2 } // then XCTAssertEqual(testInt, 2) } func test_then_whenInvokedOnNilValue_thenOperationIsNotInvoked() { // given var testInt = 0 let nilledNumber: Int? = nil // when nilledNumber.then { _ in testInt = 2 } // then XCTAssertEqual(testInt, 0) } // MARK: - onSome func test_onSome_whenInvokedOnNonNilValue_thenOperationIsInvoked_andOperationResultIsReturned() { // given var testInt = 0 let nonNilledNumber: Int? = 3 // when let result = nonNilledNumber.onSome { _ in testInt = 2 } // then XCTAssertEqual(testInt, 2) XCTAssertEqual(result, 3) } func test_onSome_whenInvokedOnNilValue_thenOperationIsNotInvoked_andNilIsReturned() { // given var testInt = 0 let nilledNumber: Int? = nil // when let result = nilledNumber.onSome { _ in testInt = 2 } // then XCTAssertEqual(testInt, 0) XCTAssertNil(result) } // MARK: - onNone func test_onNone_whenInvokedOnNonNilValue_thenOperationIsNotInvoked_andOperationResultIsReturned() { // given var testInt = 0 let nonNilledNumber: Int? = 3 // when let result = nonNilledNumber.onNone { _ in testInt = 2 } // then XCTAssertEqual(testInt, 0) XCTAssertEqual(result, 3) } func test_onNone_whenInvokedOnNilValue_thenOperationIsInvoked_andNilIsReturned() { // given var testInt = 0 let nilledNumber: Int? = nil // when let result = nilledNumber.onNone { _ in testInt = 2 } // then XCTAssertEqual(testInt, 2) XCTAssertNil(result) } // MARK: - isSome func test_isSome_whenInvokedOnNonNilValue_thenReturnsTrue() { // given let nonNilledNumber: Int? = 3 // then XCTAssertTrue(nonNilledNumber.isSome) } func test_isSome_whenInvokedOnNilValue_thenReturnsFalse() { // given let nilledNumber: Int? = nil // then XCTAssertFalse(nilledNumber.isSome) } // MARK: - isNone func test_isNone_whenInvokedOnNonNilValue_thenReturnsFalse() { // given let nonNilledNumber: Int? = 3 // then XCTAssertFalse(nonNilledNumber.isNone) } func test_isNone_whenInvokedOnNilValue_thenReturnsTrue() { // given let nilledNumber: Int? = nil // then XCTAssertTrue(nilledNumber.isNone) } // MARK: - maybe func test_maybe_whenInvokedOnNonNilValue_thenExecutesOperationAndReturnsItsResult() { // given let nonNilledNumber: Int? = 1 // when let result = nonNilledNumber.maybe(100) { $0 + 50 } // then XCTAssertEqual(result, 51) } func test_maybe_whenInvokedOnNilValue_thenDoesNotExecuteOperationAndReturnsDefaultValue() { // given let nilledNumber: Int? = nil // when let result = nilledNumber.maybe(100) { $0 + 50 } // then XCTAssertEqual(result, 100) } } ================================================ FILE: README.md ================================================ # OptionalExtensions [![CocoaPods](https://img.shields.io/cocoapods/v/OptionalExtensions.svg)](https://cocoapods.org/) [![Swift 4.0](https://img.shields.io/badge/Swift-4.0-orange.svg?style=flat)](https://developer.apple.com/swift/) [![License MIT](https://img.shields.io/badge/License-MIT-lightgrey.svg?style=flat)](https://opensource.org/licenses/MIT) ![](https://camo.githubusercontent.com/410f44c161ebf367eacb1fcce9121e336e211bc6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f506c6174666f726d2d696f732532302537432532306f737825323025374325323077617463686f7325323025374325323074766f732d6c69676874677265792e7376673f7374796c653d666c6174) Why? ---- Swift's Optional is pretty awesome, but it can always get better. This repository is an humble attempt to add some utility methods to it. Operators -------- * [filter](https://github.com/RuiAAPeres/OptionalExtensions#filter-wrapped---bool---optionalwrapped) * [mapNil](https://github.com/RuiAAPeres/OptionalExtensions#mapnil-void---wrapped---optionalwrapped) * [flatMapNil](https://github.com/RuiAAPeres/OptionalExtensions#flatmapnil-void---optionalwrapped---optionalwrapped) * [then](https://github.com/RuiAAPeres/OptionalExtensions#then-wrapped---void---void-similar-to-ts-foreach) * [maybe](https://github.com/RuiAAPeres/OptionalExtensions#maybe-u---wrapped---u---u-similar-to-haskells-maybe) * [onSome](https://github.com/RuiAAPeres/OptionalExtensions#onsome-wrapped---void---optionalwrapped-injects-a-side-effect-in-the-some-branch) * [onNone](https://github.com/RuiAAPeres/OptionalExtensions#onnone-void---void---optionalwrapped-injects-a-side-effect-in-the-none-branch) * [isSome](https://github.com/RuiAAPeres/OptionalExtensions#issome-bool) * [isNone](https://github.com/RuiAAPeres/OptionalExtensions#isnone-bool) #### `filter: (Wrapped -> Bool) -> Optional` ```swift let number: Int? = 3 let biggerThan2 = number.filter { $0 > 2 } // .Some(3) let biggerThan3 = number.filter { $0 > 3 } // .None ``` #### `mapNil: (Void -> Wrapped) -> Optional` ```swift let number: Int? = 3 number.mapNil { 2 } // .Some(3) let nilledNumber: Int? = nil nilledNumber.mapNil { 2 } // .Some(2) ``` #### `flatMapNil: (Void -> Optional) -> Optional` ```swift let number: Int? = 3 number.flatMapNil { .Some(2) } // .Some(3) let nilledNumber: Int? = nil nilledNumber.flatMapNil { .Some(2) } // .Some(2) ``` #### `then: (Wrapped -> Void) -> Void` (similar to `[T]`'s `forEach`) ```swift let number: Int? = 3 number.then { print($0) } // prints "3" let nilledNumber: Int? = nil nilledNumber.then { print($0) } // print won't be called ``` #### `maybe: U -> (Wrapped -> U) -> U` (similar to Haskell's `maybe`) ```swift let number: Int? = 3 number.maybe(100) { $0 + 1 } // 4 let nilledNumber: Int? = nil nilledNumber.maybe(100) { $0 + 1 } // 100 ``` #### `onSome: (Wrapped -> Void) -> Optional` (injects a side effect in the `.Some` branch) ```swift let number: Int? = 3 let sameNumber = number.onSome { print($0) } // prints "3" & returns .Some(3) let nilledNumber: Int? = nil let sameNilledNumber = nilledNumber.onSome { print($0) } // .None ``` #### `onNone: (Void -> Void) -> Optional` (injects a side effect in the `.None` branch) ```swift let number: Int? = 3 let sameNumber = number.onNone { print("Hello World") } // .Some(3) let nilledNumber: Int? = nil let sameNilledNumber = nilledNumber.onNone { print("Hello World") } // prints "Hello World" & returns .None ``` #### `isSome: Bool` ```swift let number: Int? = 3 let isSome = number.isSome // true let nilledNumber: Int? = nil let isSome = nilledNumber.isSome // false ``` #### `isNone: Bool` ```swift let number: Int? = 3 let isSome = number.isNone // false let nilledNumber: Int? = nil let isSome = nilledNumber.isNone // true ``` Setup ----- **Carthage:** ``` github "RuiAAPeres/OptionalExtensions" ``` **CocoaPods:** ``` pod "OptionalExtensions" ``` **Manually:** Grab the [OptionalExtensions.swift](https://github.com/RuiAAPeres/OptionalExtensions/blob/master/OptionalExtensions/Source/OptionalExtensions.swift) file and drop it in your project. Contributing ----------- We will gladly accept Pull Requests with new methods or improving the ones that already exist. Documentation, or tests, are always welcome as well. ❤️ License ------- OptionalExtensions is licensed under the MIT License, Version 2.0. [View the license file](LICENSE) Copyright (c) 2015 Rui Peres