Repository: Weebly/OrderedSet Branch: master Commit: 3ccfa8569652 Files: 25 Total size: 113.3 KB Directory structure: gitextract_c5veyalv/ ├── .gitignore ├── .travis.yml ├── Framework/ │ ├── Info.plist │ ├── OrderedSet.h │ └── PrivacyInfo.xcprivacy ├── LICENSE ├── OrderedSet.podspec ├── Package.swift ├── Project Files/ │ ├── OrderedSet/ │ │ ├── AppDelegate.swift │ │ ├── Base.lproj/ │ │ │ ├── LaunchScreen.xib │ │ │ └── Main.storyboard │ │ ├── Images.xcassets/ │ │ │ └── AppIcon.appiconset/ │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── MasterViewController.swift │ ├── OrderedSet.xcodeproj/ │ │ ├── project.pbxproj │ │ ├── project.xcworkspace/ │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata/ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata/ │ │ └── xcschemes/ │ │ ├── OrderedSet-iOS.xcscheme │ │ ├── OrderedSet-macOS.xcscheme │ │ ├── OrderedSet-tvOS.xcscheme │ │ └── OrderedSet.xcscheme │ └── OrderedSetTests/ │ ├── Info.plist │ └── OrderedSet_Tests.swift ├── README.md └── Sources/ └── OrderedSet.swift ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ xcuserdata *.xctimeline *.xccheckout *.xcscmblueprint *.mode2v3 *.pbxuser (*)/ .DS_Store Carthage/ ================================================ FILE: .travis.yml ================================================ language: swift osx_image: xcode10.2 script: xcodebuild -sdk iphonesimulator12.2 -destination 'platform=iOS Simulator,name=iPhone 8,OS=12.2' -project Project\ Files/OrderedSet.xcodeproj -scheme OrderedSet build test ================================================ FILE: Framework/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType FMWK CFBundleShortVersionString 3.0.1 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSHumanReadableCopyright Copyright © 2016 Weebly. All rights reserved. NSPrincipalClass ================================================ FILE: Framework/OrderedSet.h ================================================ // // OrderedSet.h // OrderedSet // // Created by Torsten Louland on 26/11/2016. // Copyright © 2016 Weebly. All rights reserved. // #import FOUNDATION_EXPORT double OrderedSetVersionNumber; FOUNDATION_EXPORT const unsigned char OrderedSetVersionString[]; ================================================ FILE: Framework/PrivacyInfo.xcprivacy ================================================ NSPrivacyCollectedDataTypes NSPrivacyAccessedAPITypes NSPrivacyTrackingDomains NSPrivacyTracking ================================================ FILE: LICENSE ================================================ Copyright (c) 2015, Weebly 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.m of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of Weebly nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Weebly, Inc BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================ FILE: OrderedSet.podspec ================================================ Pod::Spec.new do |s| s.name = "OrderedSet" s.version = "6.0.3" s.summary = "A Swift implementation of an OrderedSet." s.description = <<-DESC NSOrderedSet is great and all, but you can't stuff enums and structs into it, and it lacks the mutability constraints that other collection types in Swift through var and let. Introducing OrderedSet, a wholly-Swift implementation of the common ordered, unique collection! DESC s.homepage = "https://github.com/Weebly/OrderedSet" s.license = { :type => "MIT", :file => "LICENSE" } s.author = { "Jace Conflenti" => "jace@squareup.com" } s.social_media_url = "http://twitter.com/ketzusaka" s.ios.deployment_target = "12.0" s.osx.deployment_target = "10.13" s.tvos.deployment_target = "12.0" s.watchos.deployment_target = "5.2" s.swift_version = '5.0' s.source = { :git => "https://github.com/Weebly/OrderedSet.git", :tag => "v6.0.3" } s.resource_bundles = {'OrderedSet_privacy' => ['Framework/PrivacyInfo.xcprivacy']} s.requires_arc = true s.source_files = "Sources/*.{swift}" end ================================================ FILE: Package.swift ================================================ // swift-tools-version:4.2 import PackageDescription let package = Package( name: "OrderedSet", products: [.library(name: "OrderedSet", targets: ["OrderedSet"])], targets: [.target(name: "OrderedSet", path: "Sources")] ) ================================================ FILE: Project Files/OrderedSet/AppDelegate.swift ================================================ // // AppDelegate.swift // OrderedSet // // Created by James Richard on 1/6/15. // Copyright (c) 2015 Weebly. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? internal func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } } ================================================ FILE: Project Files/OrderedSet/Base.lproj/LaunchScreen.xib ================================================ ================================================ FILE: Project Files/OrderedSet/Base.lproj/Main.storyboard ================================================ ================================================ FILE: Project Files/OrderedSet/Images.xcassets/AppIcon.appiconset/Contents.json ================================================ { "images" : [ { "idiom" : "iphone", "size" : "29x29", "scale" : "2x" }, { "idiom" : "iphone", "size" : "29x29", "scale" : "3x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "2x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "3x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "2x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "3x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: Project Files/OrderedSet/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType APPL CFBundleShortVersionString 3.0.1 CFBundleSignature ???? CFBundleVersion 2 LSRequiresIPhoneOS UILaunchStoryboardName LaunchScreen UIMainStoryboardFile Main UIRequiredDeviceCapabilities armv7 UIStatusBarTintParameters UINavigationBar Style UIBarStyleDefault Translucent UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight ================================================ FILE: Project Files/OrderedSet/MasterViewController.swift ================================================ // // MasterViewController.swift // OrderedSet // // Created by James Richard on 1/6/15. // Copyright (c) 2015 Weebly. // import UIKit class MasterViewController: UITableViewController { var objects = OrderedSet() override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. self.navigationItem.leftBarButtonItem = self.editButtonItem let addButton = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(MasterViewController.insertNewObject(_:))) self.navigationItem.rightBarButtonItem = addButton } @objc func insertNewObject(_ sender: AnyObject) { objects.insert(Date(), at: 0) let indexPath = IndexPath(row: 0, section: 0) self.tableView.insertRows(at: [indexPath], with: .automatic) } // MARK: - Table View override func numberOfSections(in tableView: UITableView) -> Int { return 1 } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return objects.count } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as UITableViewCell let object = objects[(indexPath as NSIndexPath).row] as Date cell.textLabel!.text = object.description return cell } override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { // Return false if you do not want the specified item to be editable. return true } override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) { if editingStyle == .delete { objects.removeObject(at: indexPath.row) tableView.deleteRows(at: [indexPath], with: .fade) } } } ================================================ FILE: Project Files/OrderedSet.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 54; objects = { /* Begin PBXBuildFile section */ 0319D6592BD2BA31009E47CE /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 0319D6582BD2BA31009E47CE /* PrivacyInfo.xcprivacy */; }; 0319D65A2BD2BA31009E47CE /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 0319D6582BD2BA31009E47CE /* PrivacyInfo.xcprivacy */; }; 0319D65B2BD2BA31009E47CE /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 0319D6582BD2BA31009E47CE /* PrivacyInfo.xcprivacy */; }; 0319D65C2BD2BA31009E47CE /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 0319D6582BD2BA31009E47CE /* PrivacyInfo.xcprivacy */; }; 0319D65D2BD2BA31009E47CE /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 0319D6582BD2BA31009E47CE /* PrivacyInfo.xcprivacy */; }; 1A15ED131A5DC30B00D40BDD /* OrderedSet_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A15ED121A5DC30B00D40BDD /* OrderedSet_Tests.swift */; }; 1ABC4FBD1A5C966200DC4F4D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ABC4FBC1A5C966200DC4F4D /* AppDelegate.swift */; }; 1ABC4FBF1A5C966200DC4F4D /* MasterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ABC4FBE1A5C966200DC4F4D /* MasterViewController.swift */; }; 1ABC4FC41A5C966200DC4F4D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1ABC4FC21A5C966200DC4F4D /* Main.storyboard */; }; 1ABC4FC61A5C966200DC4F4D /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1ABC4FC51A5C966200DC4F4D /* Images.xcassets */; }; 1ABC4FC91A5C966200DC4F4D /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1ABC4FC71A5C966200DC4F4D /* LaunchScreen.xib */; }; 1ABC4FDF1A5C97F500DC4F4D /* OrderedSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ABC4FDE1A5C97F500DC4F4D /* OrderedSet.swift */; }; 1AD4D0AC20C0E6A2008B34B1 /* OrderedSet.h in Headers */ = {isa = PBXBuildFile; fileRef = AEBBEBB01DE9B371005525DE /* OrderedSet.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1AF415F220C0E8D30030FC7F /* OrderedSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ABC4FDE1A5C97F500DC4F4D /* OrderedSet.swift */; }; AEBBEBB21DE9B371005525DE /* OrderedSet.h in Headers */ = {isa = PBXBuildFile; fileRef = AEBBEBB01DE9B371005525DE /* OrderedSet.h */; settings = {ATTRIBUTES = (Public, ); }; }; AEBBEBB61DE9B4E5005525DE /* OrderedSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ABC4FDE1A5C97F500DC4F4D /* OrderedSet.swift */; }; AEBBEBC41DE9B852005525DE /* OrderedSet.h in Headers */ = {isa = PBXBuildFile; fileRef = AEBBEBB01DE9B371005525DE /* OrderedSet.h */; settings = {ATTRIBUTES = (Public, ); }; }; AEBBEBC51DE9B859005525DE /* OrderedSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ABC4FDE1A5C97F500DC4F4D /* OrderedSet.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ 1ABC4FCF1A5C966200DC4F4D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 1ABC4FAF1A5C966200DC4F4D /* Project object */; proxyType = 1; remoteGlobalIDString = 1ABC4FB61A5C966200DC4F4D; remoteInfo = OrderedSet; }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ 0319D6582BD2BA31009E47CE /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; 1A15ED121A5DC30B00D40BDD /* OrderedSet_Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrderedSet_Tests.swift; sourceTree = ""; }; 1A6B154022B5C095006F3A5C /* OrderedSet.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OrderedSet.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 1ABC4FB71A5C966200DC4F4D /* OrderedSet.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OrderedSet.app; sourceTree = BUILT_PRODUCTS_DIR; }; 1ABC4FBB1A5C966200DC4F4D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 1ABC4FBC1A5C966200DC4F4D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 1ABC4FBE1A5C966200DC4F4D /* MasterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MasterViewController.swift; sourceTree = ""; }; 1ABC4FC31A5C966200DC4F4D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 1ABC4FC51A5C966200DC4F4D /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 1ABC4FC81A5C966200DC4F4D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 1ABC4FCE1A5C966200DC4F4D /* OrderedSetTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OrderedSetTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 1ABC4FD31A5C966200DC4F4D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 1ABC4FDE1A5C97F500DC4F4D /* OrderedSet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OrderedSet.swift; path = ../../Sources/OrderedSet.swift; sourceTree = ""; }; 1AD4D0A420C0E61C008B34B1 /* OrderedSet.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OrderedSet.framework; sourceTree = BUILT_PRODUCTS_DIR; }; AEBBEBAE1DE9B371005525DE /* OrderedSet.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OrderedSet.framework; sourceTree = BUILT_PRODUCTS_DIR; }; AEBBEBB01DE9B371005525DE /* OrderedSet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OrderedSet.h; sourceTree = ""; }; AEBBEBB11DE9B371005525DE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; AEBBEBBC1DE9B78F005525DE /* OrderedSet.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OrderedSet.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 1A6B153D22B5C095006F3A5C /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; 1ABC4FB41A5C966200DC4F4D /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; 1ABC4FCB1A5C966200DC4F4D /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; 1AD4D0A020C0E61C008B34B1 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; AEBBEBAA1DE9B371005525DE /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; AEBBEBB81DE9B78F005525DE /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 1ABC4FAE1A5C966200DC4F4D = { isa = PBXGroup; children = ( 1ABC4FB91A5C966200DC4F4D /* OrderedSet */, 1ABC4FD11A5C966200DC4F4D /* OrderedSetTests */, AEBBEBAF1DE9B371005525DE /* Framework Support */, 1ABC4FB81A5C966200DC4F4D /* Products */, ); sourceTree = ""; }; 1ABC4FB81A5C966200DC4F4D /* Products */ = { isa = PBXGroup; children = ( 1ABC4FB71A5C966200DC4F4D /* OrderedSet.app */, 1ABC4FCE1A5C966200DC4F4D /* OrderedSetTests.xctest */, AEBBEBAE1DE9B371005525DE /* OrderedSet.framework */, AEBBEBBC1DE9B78F005525DE /* OrderedSet.framework */, 1AD4D0A420C0E61C008B34B1 /* OrderedSet.framework */, 1A6B154022B5C095006F3A5C /* OrderedSet.framework */, ); name = Products; sourceTree = ""; }; 1ABC4FB91A5C966200DC4F4D /* OrderedSet */ = { isa = PBXGroup; children = ( 1ABC4FDE1A5C97F500DC4F4D /* OrderedSet.swift */, 1ABC4FBC1A5C966200DC4F4D /* AppDelegate.swift */, 1ABC4FBE1A5C966200DC4F4D /* MasterViewController.swift */, 1ABC4FC21A5C966200DC4F4D /* Main.storyboard */, 1ABC4FC51A5C966200DC4F4D /* Images.xcassets */, 1ABC4FC71A5C966200DC4F4D /* LaunchScreen.xib */, 1ABC4FBA1A5C966200DC4F4D /* Supporting Files */, ); path = OrderedSet; sourceTree = ""; }; 1ABC4FBA1A5C966200DC4F4D /* Supporting Files */ = { isa = PBXGroup; children = ( 1ABC4FBB1A5C966200DC4F4D /* Info.plist */, ); name = "Supporting Files"; sourceTree = ""; }; 1ABC4FD11A5C966200DC4F4D /* OrderedSetTests */ = { isa = PBXGroup; children = ( 1A15ED121A5DC30B00D40BDD /* OrderedSet_Tests.swift */, 1ABC4FD21A5C966200DC4F4D /* Supporting Files */, ); path = OrderedSetTests; sourceTree = ""; }; 1ABC4FD21A5C966200DC4F4D /* Supporting Files */ = { isa = PBXGroup; children = ( 1ABC4FD31A5C966200DC4F4D /* Info.plist */, ); name = "Supporting Files"; sourceTree = ""; }; AEBBEBAF1DE9B371005525DE /* Framework Support */ = { isa = PBXGroup; children = ( 0319D6582BD2BA31009E47CE /* PrivacyInfo.xcprivacy */, AEBBEBB01DE9B371005525DE /* OrderedSet.h */, AEBBEBB11DE9B371005525DE /* Info.plist */, ); name = "Framework Support"; path = ../Framework; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ 1A6B153B22B5C095006F3A5C /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; 1AD4D0A120C0E61C008B34B1 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( 1AD4D0AC20C0E6A2008B34B1 /* OrderedSet.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; AEBBEBAB1DE9B371005525DE /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( AEBBEBB21DE9B371005525DE /* OrderedSet.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; AEBBEBB91DE9B78F005525DE /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( AEBBEBC41DE9B852005525DE /* OrderedSet.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ 1A6B153F22B5C095006F3A5C /* OrderedSet-watchOS */ = { isa = PBXNativeTarget; buildConfigurationList = 1A6B154722B5C095006F3A5C /* Build configuration list for PBXNativeTarget "OrderedSet-watchOS" */; buildPhases = ( 1A6B153B22B5C095006F3A5C /* Headers */, 1A6B153C22B5C095006F3A5C /* Sources */, 1A6B153D22B5C095006F3A5C /* Frameworks */, 1A6B153E22B5C095006F3A5C /* Resources */, ); buildRules = ( ); dependencies = ( ); name = "OrderedSet-watchOS"; productName = "OrderedSet-watchOS"; productReference = 1A6B154022B5C095006F3A5C /* OrderedSet.framework */; productType = "com.apple.product-type.framework"; }; 1ABC4FB61A5C966200DC4F4D /* OrderedSet */ = { isa = PBXNativeTarget; buildConfigurationList = 1ABC4FD81A5C966200DC4F4D /* Build configuration list for PBXNativeTarget "OrderedSet" */; buildPhases = ( 1ABC4FB31A5C966200DC4F4D /* Sources */, 1ABC4FB41A5C966200DC4F4D /* Frameworks */, 1ABC4FB51A5C966200DC4F4D /* Resources */, ); buildRules = ( ); dependencies = ( ); name = OrderedSet; productName = OrderedSet; productReference = 1ABC4FB71A5C966200DC4F4D /* OrderedSet.app */; productType = "com.apple.product-type.application"; }; 1ABC4FCD1A5C966200DC4F4D /* OrderedSetTests */ = { isa = PBXNativeTarget; buildConfigurationList = 1ABC4FDB1A5C966200DC4F4D /* Build configuration list for PBXNativeTarget "OrderedSetTests" */; buildPhases = ( 1ABC4FCA1A5C966200DC4F4D /* Sources */, 1ABC4FCB1A5C966200DC4F4D /* Frameworks */, 1ABC4FCC1A5C966200DC4F4D /* Resources */, ); buildRules = ( ); dependencies = ( 1ABC4FD01A5C966200DC4F4D /* PBXTargetDependency */, ); name = OrderedSetTests; productName = OrderedSetTests; productReference = 1ABC4FCE1A5C966200DC4F4D /* OrderedSetTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; 1AD4D0A320C0E61C008B34B1 /* OrderedSet-tvOS */ = { isa = PBXNativeTarget; buildConfigurationList = 1AD4D0A920C0E61C008B34B1 /* Build configuration list for PBXNativeTarget "OrderedSet-tvOS" */; buildPhases = ( 1AD4D09F20C0E61C008B34B1 /* Sources */, 1AD4D0A020C0E61C008B34B1 /* Frameworks */, 1AD4D0A120C0E61C008B34B1 /* Headers */, 1AD4D0A220C0E61C008B34B1 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = "OrderedSet-tvOS"; productName = "OrderedSet-tvOS"; productReference = 1AD4D0A420C0E61C008B34B1 /* OrderedSet.framework */; productType = "com.apple.product-type.framework"; }; AEBBEBAD1DE9B371005525DE /* OrderedSet-iOS */ = { isa = PBXNativeTarget; buildConfigurationList = AEBBEBB51DE9B371005525DE /* Build configuration list for PBXNativeTarget "OrderedSet-iOS" */; buildPhases = ( AEBBEBA91DE9B371005525DE /* Sources */, AEBBEBAA1DE9B371005525DE /* Frameworks */, AEBBEBAB1DE9B371005525DE /* Headers */, AEBBEBAC1DE9B371005525DE /* Resources */, ); buildRules = ( ); dependencies = ( ); name = "OrderedSet-iOS"; productName = "OrderedSet-iOS"; productReference = AEBBEBAE1DE9B371005525DE /* OrderedSet.framework */; productType = "com.apple.product-type.framework"; }; AEBBEBBB1DE9B78F005525DE /* OrderedSet-macOS */ = { isa = PBXNativeTarget; buildConfigurationList = AEBBEBC11DE9B78F005525DE /* Build configuration list for PBXNativeTarget "OrderedSet-macOS" */; buildPhases = ( AEBBEBB71DE9B78F005525DE /* Sources */, AEBBEBB81DE9B78F005525DE /* Frameworks */, AEBBEBB91DE9B78F005525DE /* Headers */, AEBBEBBA1DE9B78F005525DE /* Resources */, ); buildRules = ( ); dependencies = ( ); name = "OrderedSet-macOS"; productName = "OrderedSet-macOS"; productReference = AEBBEBBC1DE9B78F005525DE /* OrderedSet.framework */; productType = "com.apple.product-type.framework"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 1ABC4FAF1A5C966200DC4F4D /* Project object */ = { isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = YES; LastSwiftUpdateCheck = 0710; LastUpgradeCheck = 1510; ORGANIZATIONNAME = Weebly; TargetAttributes = { 1A6B153F22B5C095006F3A5C = { CreatedOnToolsVersion = 10.2; DevelopmentTeam = 5M378EFHK7; ProvisioningStyle = Automatic; }; 1ABC4FB61A5C966200DC4F4D = { CreatedOnToolsVersion = 6.1.1; LastSwiftMigration = 0900; }; 1ABC4FCD1A5C966200DC4F4D = { CreatedOnToolsVersion = 6.1.1; LastSwiftMigration = 0900; TestTargetID = 1ABC4FB61A5C966200DC4F4D; }; 1AD4D0A320C0E61C008B34B1 = { CreatedOnToolsVersion = 9.3; ProvisioningStyle = Automatic; }; AEBBEBAD1DE9B371005525DE = { CreatedOnToolsVersion = 8.1; LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; AEBBEBBB1DE9B78F005525DE = { CreatedOnToolsVersion = 8.1; LastSwiftMigration = 0900; ProvisioningStyle = Automatic; }; }; }; buildConfigurationList = 1ABC4FB21A5C966200DC4F4D /* Build configuration list for PBXProject "OrderedSet" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); mainGroup = 1ABC4FAE1A5C966200DC4F4D; productRefGroup = 1ABC4FB81A5C966200DC4F4D /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 1ABC4FB61A5C966200DC4F4D /* OrderedSet */, 1ABC4FCD1A5C966200DC4F4D /* OrderedSetTests */, AEBBEBAD1DE9B371005525DE /* OrderedSet-iOS */, AEBBEBBB1DE9B78F005525DE /* OrderedSet-macOS */, 1AD4D0A320C0E61C008B34B1 /* OrderedSet-tvOS */, 1A6B153F22B5C095006F3A5C /* OrderedSet-watchOS */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 1A6B153E22B5C095006F3A5C /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 0319D65D2BD2BA31009E47CE /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; 1ABC4FB51A5C966200DC4F4D /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 1ABC4FC41A5C966200DC4F4D /* Main.storyboard in Resources */, 1ABC4FC91A5C966200DC4F4D /* LaunchScreen.xib in Resources */, 0319D6592BD2BA31009E47CE /* PrivacyInfo.xcprivacy in Resources */, 1ABC4FC61A5C966200DC4F4D /* Images.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; 1ABC4FCC1A5C966200DC4F4D /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; 1AD4D0A220C0E61C008B34B1 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 0319D65C2BD2BA31009E47CE /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; AEBBEBAC1DE9B371005525DE /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 0319D65A2BD2BA31009E47CE /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; AEBBEBBA1DE9B78F005525DE /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 0319D65B2BD2BA31009E47CE /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 1A6B153C22B5C095006F3A5C /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; 1ABC4FB31A5C966200DC4F4D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 1ABC4FDF1A5C97F500DC4F4D /* OrderedSet.swift in Sources */, 1ABC4FBF1A5C966200DC4F4D /* MasterViewController.swift in Sources */, 1ABC4FBD1A5C966200DC4F4D /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; 1ABC4FCA1A5C966200DC4F4D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 1A15ED131A5DC30B00D40BDD /* OrderedSet_Tests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; 1AD4D09F20C0E61C008B34B1 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 1AF415F220C0E8D30030FC7F /* OrderedSet.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; AEBBEBA91DE9B371005525DE /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( AEBBEBB61DE9B4E5005525DE /* OrderedSet.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; AEBBEBB71DE9B78F005525DE /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( AEBBEBC51DE9B859005525DE /* OrderedSet.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ 1ABC4FD01A5C966200DC4F4D /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 1ABC4FB61A5C966200DC4F4D /* OrderedSet */; targetProxy = 1ABC4FCF1A5C966200DC4F4D /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ 1ABC4FC21A5C966200DC4F4D /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( 1ABC4FC31A5C966200DC4F4D /* Base */, ); name = Main.storyboard; sourceTree = ""; }; 1ABC4FC71A5C966200DC4F4D /* LaunchScreen.xib */ = { isa = PBXVariantGroup; children = ( 1ABC4FC81A5C966200DC4F4D /* Base */, ); name = LaunchScreen.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 1A6B154522B5C095006F3A5C /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = dwarf; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = 5M378EFHK7; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_MODULE_VERIFIER = YES; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = ../Framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++14"; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.Weebly.OrderedSet; PRODUCT_NAME = OrderedSet; SDKROOT = watchos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 4; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; WATCHOS_DEPLOYMENT_TARGET = 5.2; }; name = Debug; }; 1A6B154622B5C095006F3A5C /* Release */ = { isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = 5M378EFHK7; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_MODULE_VERIFIER = YES; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = ../Framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++14"; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.Weebly.OrderedSet; PRODUCT_NAME = OrderedSet; SDKROOT = watchos; SKIP_INSTALL = YES; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 4; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; WATCHOS_DEPLOYMENT_TARGET = 5.2; }; name = Release; }; 1ABC4FD61A5C966200DC4F4D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; ENABLE_USER_SCRIPT_SANDBOXING = 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_SYMBOLS_PRIVATE_EXTERN = NO; 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 = 12.0; MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 5.0; TVOS_DEPLOYMENT_TARGET = 12.0; WATCHOS_DEPLOYMENT_TARGET = 5.2; }; name = Debug; }; 1ABC4FD71A5C966200DC4F4D /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_USER_SCRIPT_SANDBOXING = 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 = 12.0; MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 5.0; TVOS_DEPLOYMENT_TARGET = 12.0; VALIDATE_PRODUCT = YES; WATCHOS_DEPLOYMENT_TARGET = 5.2; }; name = Release; }; 1ABC4FD91A5C966200DC4F4D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; INFOPLIST_FILE = OrderedSet/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = "com.Weebly.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; }; 1ABC4FDA1A5C966200DC4F4D /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; INFOPLIST_FILE = OrderedSet/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = "com.Weebly.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; 1ABC4FDC1A5C966200DC4F4D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); INFOPLIST_FILE = OrderedSetTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = "com.Weebly.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/OrderedSet.app/OrderedSet"; }; name = Debug; }; 1ABC4FDD1A5C966200DC4F4D /* Release */ = { isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; INFOPLIST_FILE = OrderedSetTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = "com.Weebly.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/OrderedSet.app/OrderedSet"; }; name = Release; }; 1AD4D0AA20C0E61C008B34B1 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = dwarf; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_MODULE_VERIFIER = YES; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = ../Framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++14"; PRODUCT_BUNDLE_IDENTIFIER = com.Weebly.OrderedSet; PRODUCT_NAME = OrderedSet; SDKROOT = appletvos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 12.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; name = Debug; }; 1AD4D0AB20C0E61C008B34B1 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_MODULE_VERIFIER = YES; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = ../Framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++14"; PRODUCT_BUNDLE_IDENTIFIER = com.Weebly.OrderedSet; PRODUCT_NAME = OrderedSet; SDKROOT = appletvos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 12.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; name = Release; }; AEBBEBB31DE9B371005525DE /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; CODE_SIGN_IDENTITY = ""; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = dwarf; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_MODULE_VERIFIER = YES; EXCLUDED_ARCHS = ""; "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; INFOPLIST_FILE = ../Framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11"; PRODUCT_BUNDLE_IDENTIFIER = com.Weebly.OrderedSet; PRODUCT_NAME = "$(PROJECT_NAME)"; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; name = Debug; }; AEBBEBB41DE9B371005525DE /* Release */ = { isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; CODE_SIGN_IDENTITY = ""; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_MODULE_VERIFIER = YES; EXCLUDED_ARCHS = ""; "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; INFOPLIST_FILE = ../Framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11"; PRODUCT_BUNDLE_IDENTIFIER = com.Weebly.OrderedSet; PRODUCT_NAME = "$(PROJECT_NAME)"; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; name = Release; }; AEBBEBC21DE9B78F005525DE /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = dwarf; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_MODULE_VERIFIER = YES; FRAMEWORK_VERSION = A; INFOPLIST_FILE = ../Framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11"; PRODUCT_BUNDLE_IDENTIFIER = com.Weebly.OrderedSet; PRODUCT_NAME = "$(PROJECT_NAME)"; SDKROOT = macosx; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_SWIFT3_OBJC_INFERENCE = Off; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; name = Debug; }; AEBBEBC31DE9B78F005525DE /* Release */ = { isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_MODULE_VERIFIER = YES; FRAMEWORK_VERSION = A; INFOPLIST_FILE = ../Framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11"; PRODUCT_BUNDLE_IDENTIFIER = com.Weebly.OrderedSet; PRODUCT_NAME = "$(PROJECT_NAME)"; SDKROOT = macosx; SKIP_INSTALL = YES; SWIFT_SWIFT3_OBJC_INFERENCE = Off; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 1A6B154722B5C095006F3A5C /* Build configuration list for PBXNativeTarget "OrderedSet-watchOS" */ = { isa = XCConfigurationList; buildConfigurations = ( 1A6B154522B5C095006F3A5C /* Debug */, 1A6B154622B5C095006F3A5C /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 1ABC4FB21A5C966200DC4F4D /* Build configuration list for PBXProject "OrderedSet" */ = { isa = XCConfigurationList; buildConfigurations = ( 1ABC4FD61A5C966200DC4F4D /* Debug */, 1ABC4FD71A5C966200DC4F4D /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 1ABC4FD81A5C966200DC4F4D /* Build configuration list for PBXNativeTarget "OrderedSet" */ = { isa = XCConfigurationList; buildConfigurations = ( 1ABC4FD91A5C966200DC4F4D /* Debug */, 1ABC4FDA1A5C966200DC4F4D /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 1ABC4FDB1A5C966200DC4F4D /* Build configuration list for PBXNativeTarget "OrderedSetTests" */ = { isa = XCConfigurationList; buildConfigurations = ( 1ABC4FDC1A5C966200DC4F4D /* Debug */, 1ABC4FDD1A5C966200DC4F4D /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 1AD4D0A920C0E61C008B34B1 /* Build configuration list for PBXNativeTarget "OrderedSet-tvOS" */ = { isa = XCConfigurationList; buildConfigurations = ( 1AD4D0AA20C0E61C008B34B1 /* Debug */, 1AD4D0AB20C0E61C008B34B1 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; AEBBEBB51DE9B371005525DE /* Build configuration list for PBXNativeTarget "OrderedSet-iOS" */ = { isa = XCConfigurationList; buildConfigurations = ( AEBBEBB31DE9B371005525DE /* Debug */, AEBBEBB41DE9B371005525DE /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; AEBBEBC11DE9B78F005525DE /* Build configuration list for PBXNativeTarget "OrderedSet-macOS" */ = { isa = XCConfigurationList; buildConfigurations = ( AEBBEBC21DE9B78F005525DE /* Debug */, AEBBEBC31DE9B78F005525DE /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 1ABC4FAF1A5C966200DC4F4D /* Project object */; } ================================================ FILE: Project Files/OrderedSet.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: Project Files/OrderedSet.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist ================================================ IDEDidComputeMac32BitWarning ================================================ FILE: Project Files/OrderedSet.xcodeproj/xcshareddata/xcschemes/OrderedSet-iOS.xcscheme ================================================ ================================================ FILE: Project Files/OrderedSet.xcodeproj/xcshareddata/xcschemes/OrderedSet-macOS.xcscheme ================================================ ================================================ FILE: Project Files/OrderedSet.xcodeproj/xcshareddata/xcschemes/OrderedSet-tvOS.xcscheme ================================================ ================================================ FILE: Project Files/OrderedSet.xcodeproj/xcshareddata/xcschemes/OrderedSet.xcscheme ================================================ ================================================ FILE: Project Files/OrderedSetTests/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: Project Files/OrderedSetTests/OrderedSet_Tests.swift ================================================ // // OrderedSet_Tests.swift // Weebly // // Created by James Richard on 10/22/14. // Copyright (c) 2014 Weebly. All rights reserved. // import XCTest import OrderedSet class OrderedSet_Tests: XCTestCase { //TODO: add tests for more Swift 2.x default SequenceType and Collection implementations // MARK: Count func testCount_withoutObjects_is0() { let subject = OrderedSet() XCTAssertEqual(subject.count, 0) } // MARK: isEmpty func testIsEmpty_whenEmpty_isTrue() { let subject = OrderedSet() XCTAssertTrue(subject.isEmpty) } func testIsEmpty_whenEmptyNotEmpty_isFalse() { let subject = OrderedSet(sequence: ["One"]) XCTAssertFalse(subject.isEmpty) } // MARK: Append func testAppend_increasesCount() { var subject = OrderedSet() subject.append("Test") XCTAssertEqual(subject.count, 1) } func testAppend_withSameObjectTwice_keepsCountAs1() { var subject = OrderedSet() subject.append("Test") subject.append("Test") XCTAssertEqual(subject.count, 1) } // MARK: Subscript func testObjectSubscript_returnsCorrectObject() { var subject = OrderedSet() subject.append("Test") XCTAssert(subject[0] == "Test") } func testSubscriptInsertion_replacesObject() { var subject = OrderedSet(sequence: ["One", "Two", "Three"]) subject[1] = "wat" XCTAssertEqual(subject.count, 3) XCTAssert(subject[0] == "One") XCTAssert(subject[1] == "wat") XCTAssert(subject[2] == "Three") } func testSubscriptSetting_iteratesCorrectly() { var subject: OrderedSet = [0, 1, 2] subject[1] = 0 var contents = [Int]() for i in subject { contents.append(i) } XCTAssertEqual(contents.count, 2) XCTAssertEqual(contents[0], 0) XCTAssertEqual(contents[1], 2) } func testSubscriptAssignObjectAtIndex_doesNotAffectOtherSet() { let other: OrderedSet = ["One"] var subject = other subject[0] = "Two" XCTAssertNotEqual(subject, other) } // MARK: Contains func testContains_whenObjectIsContained_isTrue() { var subject = OrderedSet() subject.append("Test") XCTAssertTrue(subject.contains("Test")) } func testContains_whenObjectIsNotContained_isFalse() { let subject = OrderedSet() XCTAssertFalse(subject.contains("Test")) } // MARK: Enumeration func testEnumeration_enumeratesAllObjectsInOrder() { let subject = OrderedSet(sequence: ["One", "Two", "Three"]) var enumeratedObjects = [String]() for object in subject { enumeratedObjects.append(object) } let expected = ["One", "Two", "Three"] XCTAssertEqual(enumeratedObjects, expected) } // MARK: Init With Sequence func testInitWithSequence_withDuplicates_onlyCountsThemOnce() { let subject = OrderedSet(sequence: ["One", "Two", "Two", "Four"]) XCTAssertEqual(subject.count, 3) } func testInitWithSequence_withDuplicates_doesntChangeIndexAfterFirst() { let subject = OrderedSet(sequence: ["One", "Two", "Two", "Four"]) XCTAssert(subject[0] == "One") XCTAssert(subject[1] == "Two") XCTAssert(subject[2] == "Four") } // MARK: Init With Array Literal func testInitializingWithArrayLiteral_includesItemsInOrder() { let subject: OrderedSet = ["One", "Two"] var enumeratedObjects = [String]() for object in subject { enumeratedObjects.append(object) } let expected = ["One", "Two"] XCTAssertEqual(enumeratedObjects, expected) } // MARK: Index Of Object func testIndexOfObject_whenObjectExists_isCorrectIndex() { let subject = OrderedSet(sequence: ["One", "Two", "Three"]) XCTAssert(subject.index(of: "Three") == 2) } func testIndexOfObject_whenObjectDoesntExist_isNil() { let subject = OrderedSet(sequence: ["One", "Two", "Three"]) XCTAssertNil(subject.index(of: "Four")) } // MARK: Remove func testRemove_whenObjectExists_reducesCount() { var subject = OrderedSet(sequence: ["One", "Two", "Three"]) subject.remove("Two") XCTAssertEqual(subject.count, 2) } func testRemove_whenObjectDoesntExist_doesntChangeCount() { var subject = OrderedSet(sequence: ["One", "Two", "Three"]) subject.remove("Twoz") XCTAssertEqual(subject.count, 3) } func testRemove_whenObjectIsNotLast_updatesOrdering() { var subject = OrderedSet(sequence: ["One", "Two", "Three", "Four"]) subject.remove("Two") XCTAssert(subject[0] == "One") XCTAssert(subject[1] == "Three") XCTAssert(subject[2] == "Four") } // MARK: Remove Objects func testRemoveObjects_removesPassedInObjects() { var subject = OrderedSet(sequence: ["One", "Two", "Three", "Four"]) subject.remove(["Two", "Four"]) let expected: OrderedSet = ["One", "Three"] XCTAssertEqual(subject, expected) } func testRemoveObjects_returnsCollectionOfCorrectIndexPositions() { var subject = OrderedSet(sequence: ["One", "Two", "Three", "Four"]) let indexes = subject.remove(["Two", "Four"]) XCTAssertEqual(indexes, [1, 3]) } func testRemoveObjects__whenAnObjectDoesntExist_returnsCollectionOfCorrectIndexPositions() { var subject = OrderedSet(sequence: ["One", "Two", "Three", "Four"]) let indexes = subject.remove(["Two", "Three", "Six"]) XCTAssertEqual(indexes, [1, 2]) } func testRemoveObjects__whenRemovingSameObjectFromTwoSets_doesNotCrash() { var original = OrderedSet(sequence: ["One"]) var subject = original original.remove("One") subject.remove("One") } // MARK: Remove Object At Index func testRemoveObjectAtIndex_removesTheObjectAtIndex() { var subject = OrderedSet(sequence: ["One", "Two", "Three", "Four"]) subject.removeObject(at: 1) let expected: OrderedSet = ["One", "Three", "Four"] XCTAssertEqual(subject, expected) } // MARK: Index of removed Object func testRemoveObject_returnsCorrectIndex() { var subject = OrderedSet(sequence: ["One", "Two", "Three"]) let index = subject.remove("Two") XCTAssertEqual(index, 1) } // MARK: Remove All Objects func testRemoveAllObjects_removesAllObjectsThatSatisfyGivenPredicate() { var subject = OrderedSet(sequence: ["One", "Two", "Three"]) let removedObjects = subject.removeAllObjects(where: { $0.hasPrefix("T") }) let expected: OrderedSet = ["One"] XCTAssertEqual(subject, expected) let expectedRemovedObjects: OrderedSet = ["Two", "Three"] XCTAssertEqual(removedObjects, expectedRemovedObjects) } func testRemoveAllObjects_removesAllObjects() { var subject = OrderedSet(sequence: ["One", "Two", "Three"]) subject.removeAllObjects() XCTAssertEqual(subject.count, 0) } // MARK: Intersects Sequence func testIntersectsSequence_withoutIntersection_isFalse() { let subject = OrderedSet(sequence: ["One", "Two", "Three"]) XCTAssertFalse(subject.intersects(["Four"])) } func testIntersectsSequence_withIntersection_isTrue() { let subject = OrderedSet(sequence: ["One", "Two", "Three"]) XCTAssertTrue(subject.intersects(["Two"])) } // MARK: Is Subset Of Sequence func testIsSubsetOfSequence_whenIsSubset_isTrue() { let subject = OrderedSet(sequence: ["One", "Two", "Three"]) XCTAssertTrue(subject.isSubset(of: ["Three", "Two", "One"])) } func testIsSubsetOfSequence_whenIsSubset_andContainsDuplicates_isTrue() { let subject = OrderedSet(sequence: ["One", "Two", "Three"]) XCTAssertTrue(subject.isSubset(of: ["Three", "Two", "One", "Three"])) } func testIsSubsetOfSequence_whenIsNotSubset_isFalse() { let subject = OrderedSet(sequence: ["One", "Two"]) XCTAssertTrue(subject.isSubset(of: ["Three", "Two", "One"])) } // MARK: Concatenation func testConcatingOrderedSets_returnsJoinedSet() { let first: OrderedSet = ["One"] let second: OrderedSet = ["One", "Two"] let result = first + second XCTAssertEqual(result.count, 2) XCTAssert(result[0] == "One") XCTAssert(result[1] == "Two") } func testConcatAppendOrderedSets_returnsJoinedOrderedSet() { var subject: OrderedSet = ["One"] let second: OrderedSet = ["One", "Two"] subject += second XCTAssertEqual(subject.count, 2) XCTAssert(subject[0] == "One") XCTAssert(subject[1] == "Two") } // MARK: Decatenate func testDecatenate_removesMatchedObjects() { let subject: OrderedSet = ["One", "Two", "Three"] let second: OrderedSet = ["One", "Three"] let result = subject - second XCTAssertEqual(result.count, 1) XCTAssert(result[0] == "Two") } func testDecatenateEquals_removesMatchedObjects() { var subject: OrderedSet = ["One", "Two", "Three"] let second: OrderedSet = ["One", "Three"] subject -= second XCTAssertEqual(subject.count, 1) XCTAssert(subject[0] == "Two") } // MARK: Map func testMap_mapsEachObject() { let subject: OrderedSet = ["One", "Two", "Three"] let result = subject.map { $0.hashValue } let expected = ["One".hashValue, "Two".hashValue, "Three".hashValue] XCTAssertTrue(result == expected) } // MARK: Equality func testEquals_isTrue_whenEqual() { let first: OrderedSet = ["One", "Two", "Three"] let second: OrderedSet = ["One", "Two", "Three"] XCTAssertEqual(first, second) } func testEquals_isFalse_whenNotEqual() { let first: OrderedSet = ["One", "Two", "Three"] let second: OrderedSet = ["One", "Two", "Four"] XCTAssertNotEqual(first, second) } func testEquals_isFalse_whenFirstArrayIsLargerThanSecond() { let first: OrderedSet = ["One", "Two", "Three", "Four"] let second: OrderedSet = ["One", "Two", "Three"] XCTAssertNotEqual(first, second) } func testEquals_isFalse_whenSecondArrayIsLargerThanFirst() { let first: OrderedSet = ["One", "Two", "Three"] let second: OrderedSet = ["One", "Two", "Three", "Four"] XCTAssertNotEqual(first, second) } func testEquals_isFalse_whenSecondArrayIsDifferentOrderThanFirst() { let first: OrderedSet = ["One", "Two", "Three"] let second: OrderedSet = ["Three", "Two", "One"] XCTAssertNotEqual(first, second) } // MARK: First func testFirst_whenEmpty_isNil() { let subject = OrderedSet() XCTAssert(subject.first == nil) } func testFirst_whenNotEmpty_isFirstElement() { let subject: OrderedSet = ["One", "Two", "Three"] XCTAssert(subject.first == "One") } // MARK: Last func testLast_whenEmpty_isNil() { let subject = OrderedSet() XCTAssert(subject.last == nil) } func testLast_whenNotEmpty_isFirstElement() { let subject: OrderedSet = ["One", "Two", "Three"] XCTAssert(subject.last == "Three") } // MARK: - Swap Object func testSwapObject_whenBothObjectsExist_swapsBothObjects() { var subject: OrderedSet = ["One", "Two", "Three"] subject.swapObject("One", with: "Three") let expected: OrderedSet = ["Three", "Two", "One"] XCTAssertEqual(subject, expected) } func testSwapObject_whenOneObjectsExist_doesntChangeSet() { var subject: OrderedSet = ["One", "Two", "Three"] subject.swapObject("One", with: "Four") let expected: OrderedSet = ["One", "Two", "Three"] XCTAssertEqual(subject, expected) } // MARK: Move Object to Index func testMoveObjectToIndex_whenObjectExists_whenMovingAmongEntireSet_movesObjectUp_andShiftsOthersDown() { var subject: OrderedSet = ["One", "Two", "Three"] subject.moveObject("One", toIndex: 2) let expected: OrderedSet = ["Two", "Three", "One"] XCTAssertEqual(subject, expected) } func testMoveObjectToIndex_whenObjectExists_whenMovingAmongEntireSet_movesObjectDown_andShiftsOthersUp() { var subject: OrderedSet = ["One", "Two", "Three"] subject.moveObject("Three", toIndex: 0) let expected: OrderedSet = ["Three", "One", "Two"] XCTAssertEqual(subject, expected) } func testMoveObjectToIndex_whenObjectExists_whenMovingAmongSubsetOfSet_movesObjectUp_andShiftsTraversedObjectsDown() { var subject: OrderedSet = ["One", "Two", "Three", "Four", "Five"] subject.moveObject("Four", toIndex: 1) let expected: OrderedSet = ["One", "Four", "Two", "Three", "Five"] XCTAssertEqual(subject, expected) } func testMoveObjectToIndex_whenObjectExists_whenMovingAmongSubsetOfSet_movesObjectDown_andShiftsTraversedObjectsUp() { var subject: OrderedSet = ["One", "Two", "Three", "Four", "Five"] subject.moveObject("Two", toIndex: 3) let expected: OrderedSet = ["One", "Three", "Four", "Two", "Five"] XCTAssertEqual(subject, expected) } func testMoveObjectToIndex_whenObjectDoesntExist_isNoop() { var subject: OrderedSet = ["One", "Two", "Three"] subject.moveObject("Four", toIndex: 0) let expected: OrderedSet = ["One", "Two", "Three"] XCTAssertEqual(subject, expected) } func testMoveObjectToIndex_whenObjectIsSameIndex_isNoop() { var subject: OrderedSet = ["One", "Two", "Three"] subject.moveObject("One", toIndex: 0) let expected: OrderedSet = ["One", "Two", "Three"] XCTAssertEqual(subject, expected) } func testMoveObject_withFullMove_mapsCorrectly() { var subject: OrderedSet = ["One", "Two", "Three", "Four", "Five"] subject.moveObject("One", toIndex: 4) XCTAssertEqual(subject.map { $0 }, ["Two", "Three", "Four", "Five", "One"]) } func testMoveObject_withInnerMove_mapsCorrectly() { var subject: OrderedSet = ["p0", "p1", "c1", "p2", "p3", "c2"] subject.moveObject("p2", toIndex: 1) XCTAssertEqual(subject.map { $0 }, ["p0", "p2", "p1", "c1", "p3", "c2"]) } // MARK: Insert Object at Index func testMoveObjectAtIndex_whenObjectExists_whenMovingAmongEntireSet_movesObjectUp_andShiftsOthersDown() { var subject: OrderedSet = ["One", "Two", "Three"] subject.moveObject(at: 0, to: 2) let expected: OrderedSet = ["Two", "Three", "One"] XCTAssertEqual(subject, expected) } func testMoveObjectAtIndex_whenObjectExists_whenMovingAmongEntireSet_movesObjectDown_andShiftsOthersUp() { var subject: OrderedSet = ["One", "Two", "Three"] subject.moveObject(at: 2, to: 0) let expected: OrderedSet = ["Three", "One", "Two"] XCTAssertEqual(subject, expected) } func testMoveObjectAtIndex_whenObjectExists_whenMovingAmongSubsetOfSet_movesObjectUp_andShiftsTraversedObjectsDown() { var subject: OrderedSet = ["One", "Two", "Three", "Four", "Five"] subject.moveObject(at: 3, to: 1) let expected: OrderedSet = ["One", "Four", "Two", "Three", "Five"] XCTAssertEqual(subject, expected) } func testMoveObjectAtIndex_whenObjectExists_whenMovingAmongSubsetOfSet_movesObjectDown_andShiftsTraversedObjectsUp() { var subject: OrderedSet = ["One", "Two", "Three", "Four", "Five"] subject.moveObject(at: 1, to: 3) let expected: OrderedSet = ["One", "Three", "Four", "Two", "Five"] XCTAssertEqual(subject, expected) } func testMoveObjectAtIndex_whenSameIndexes_isNoop() { var subject: OrderedSet = ["One", "Two", "Three"] subject.moveObject(at: 0, to: 0) let expected: OrderedSet = ["One", "Two", "Three"] XCTAssertEqual(subject, expected) } func testInsertObjectAtIndex_whenObjectDoesntExist_insertsObjectAtCorrectSpot() { var subject: OrderedSet = ["One", "Two", "Three"] subject.insert("Zero", at: 0) let expected: OrderedSet = ["Zero", "One", "Two", "Three"] XCTAssertEqual(subject, expected) } func testInsertObjectAtIndex_whenObjectDoesExist_isNoop() { var subject: OrderedSet = ["One", "Two", "Three"] subject.insert("Two", at: 0) let expected: OrderedSet = ["One", "Two", "Three"] XCTAssertEqual(subject, expected) } func testInsertObjectAtIndex_canInsertObjectAtTail() { var subject: OrderedSet = ["One", "Two", "Three"] subject.insert("Four", at: 3) let expected: OrderedSet = ["One", "Two", "Three", "Four"] XCTAssertEqual(subject, expected) } // MARK: Insert Objects at Index func testInsertObjectsAtIndex_whenObjectsDontExist_insertsObjectsAtCorrectSpot() { var subject: OrderedSet = ["One", "Two", "Three"] subject.insert(["Foo", "Bar"], at: 1) let expected: OrderedSet = ["One", "Foo", "Bar", "Two", "Three"] XCTAssertEqual(subject, expected) } func testInsertObjectsAtIndex_whenSomeObjectsExist_insertsOnlyNonExistingObjectsAtCorrectSpot() { var subject: OrderedSet = ["One", "Two", "Three"] subject.insert(["Foo", "Three"], at: 1) let expected: OrderedSet = ["One", "Foo", "Two", "Three"] XCTAssertEqual(subject, expected) } func testInsertObjectsAtIndex_whenRepeatedObjectsAreInserted_insertsOnlyOne() { var subject: OrderedSet = ["One", "Two", "Three"] subject.insert(["Foo", "Foo"], at: 1) let expected: OrderedSet = ["One", "Foo", "Two", "Three"] XCTAssertEqual(subject, expected) } func testInsertObjectsAtIndex_canInsertObjectAtTail() { var subject: OrderedSet = ["One", "Two", "Three"] subject.insert(["Four", "Five"], at: 3) let expected: OrderedSet = ["One", "Two", "Three", "Four", "Five"] XCTAssertEqual(subject, expected) } // MARK: Append Objects func testAppendObjects_whenObjectsDontExist_appendsAllObjects() { var subject: OrderedSet = ["One", "Two", "Three"] subject.append(contentsOf: ["Foo", "Bar"]) let expected: OrderedSet = ["One", "Two", "Three", "Foo", "Bar"] XCTAssertEqual(subject, expected) } func testAppendObjects_whenSomeObjectsExist_appendsOnlyNonExistingObjects() { var subject: OrderedSet = ["One", "Two", "Three"] subject.append(contentsOf: ["Foo", "Two"]) let expected: OrderedSet = ["One", "Two", "Three", "Foo"] XCTAssertEqual(subject, expected) } func testAppendObjects_whenRepeatedObjectsAreAppended_appendsOnlyOne() { var subject: OrderedSet = ["One", "Two", "Three"] subject.append(contentsOf: ["Foo", "Foo"]) let expected: OrderedSet = ["One", "Two", "Three", "Foo"] XCTAssertEqual(subject, expected) } // MARK: Description func testDescription_printsDescription() { let subject: OrderedSet = ["One", "Two", "Three"] XCTAssertEqual(subject.description, "OrderedSet (3 object(s)): [One, Two, Three]") } // MARK: Operator Overloads func testAddOperator_appendsSequence() { let initial: OrderedSet = ["One", "Two"] let subject = initial + ["Three"] XCTAssertEqual(initial, ["One", "Two"]) XCTAssertEqual(subject, ["One", "Two", "Three"]) } func testAddInPlaceOperator_appendsSequence() { var subject: OrderedSet = ["One", "Two"] subject += ["Three"] XCTAssertEqual(subject, ["One", "Two", "Three"]) } func testSubtractOperator_removesSequence() { let initial: OrderedSet = ["One", "Two", "Three"] let subject = initial - ["Three"] XCTAssertEqual(initial, ["One", "Two", "Three"]) XCTAssertEqual(subject, ["One", "Two"]) } func testSubtractInPlaceOperator_removesSequence() { var subject: OrderedSet = ["One", "Two", "Three"] subject -= ["Three"] XCTAssertEqual(subject, ["One", "Two"]) } } ================================================ FILE: README.md ================================================ # Introduction OrderedSet is essentially the Swift equivalent of Foundation's NSOrderedSet/NSMutableOrderedSet. It was created so Swift would have a unique, ordered collection with fast lookup performance that supported strong typing through Generics, and so we could store Swift structs and enums in it. # Usage OrderedSet works very much like an Array. Here are some basic examples of its usage: ```swift var set = OrderedSet() set.append(1) set.contains(1) // => true set[0] = 2 set[0] // => 2 set.insert(3, at: 0) set // => [3, 2] set = [1,2,3] // OrderedSet's support array literals set // => [1, 2, 3] set += [3, 4] // You can concatenate any sequence type to an OrderedSet set // => [1, 2, 3, 4] (Since 3 was already in the set it was not added again) ``` Its also recommended that you use the instance methods when possible instead of the global Swift methods for searching an OrderedSet. For example, the Swift.contains(haystack, needle) method will enumerate the OrderedSet instead of making use of the fast lookup implementation that the OrderedSet.contains(needle) method will do. Be sure to check out the unit tests to see all the different ways to interact with an OrderedSet in action. You can also check out the sample project, which tweaks the default master/detail project to use an OrderedSet instead of an Array. # Installation OrderedSet is a single Swift file in the Sources directory. You can copy that file into your project, or use via CocoaPods by adding the following line to your Podfile: ```ruby pod 'OrderedSet', '5.0' ``` or use via Carthage by adding ``` github "Weebly/OrderedSet" ``` to your Cartfile and embedding the OrderedSet.framework in your app. And then add the following import where you want to use OrderedSet: ```swift import OrderedSet ``` Using SwiftPM: ```swift package.append(.package(url: "https://github.com/Weebly/OrderedSet.git", .upToNextMajor(from: "5.0.0"))) ``` # License OrderedSet is available under the MIT license. See the LICENSE file for more info. # CONTRIBUTING We love to have your help to make OrderedSet better. Feel free to * open an issue if you run into any problem. * fork the project and submit pull request. ================================================ FILE: Sources/OrderedSet.swift ================================================ // Copyright (c) 2014 James Richard. // Distributed under the MIT License (http://opensource.org/licenses/MIT). /// An ordered, unique collection of objects. public struct OrderedSet { fileprivate var contents = [T: Index]() // Needs to have a value of Index instead of Void for fast removals fileprivate var sequencedContents = SequencedContents() fileprivate class SequencedContents { fileprivate var pointers = [UnsafeMutablePointer]() func append(_ element: UnsafeMutablePointer) { pointers.append(element) } func index(after i: Int) -> Int { return pointers.index(after: i) } func insert(_ element: UnsafeMutablePointer, at i: Int) { pointers.insert(element, at: i) } var last: UnsafeMutablePointer? { return pointers.last } @discardableResult func remove(at i: Int) -> UnsafeMutablePointer { return pointers.remove(at: i) } func removeAll() { pointers.removeAll() } subscript(_ i: Int) -> UnsafeMutablePointer { get { return pointers[i] } set { pointers[i] = newValue } } func copy() -> SequencedContents { let copy = SequencedContents() copy.pointers.reserveCapacity(pointers.count) for p in pointers { let newP = UnsafeMutablePointer.allocate(capacity: 1) newP.initialize(from: p, count: 1) copy.pointers.append(newP) } return copy } } /** Inititalizes an empty ordered set. - returns: An empty ordered set. */ public init() { } /** Initializes a new ordered set with the order and contents of sequence. If an object appears more than once in the sequence it will only appear once in the ordered set, at the position of its first occurance. - parameter sequence: The sequence to initialize the ordered set with. - returns: An initialized ordered set with the contents of sequence. */ public init(sequence: S) where S.Iterator.Element == T { for object in sequence where contents[object] == nil { contents[object] = contents.count let pointer = UnsafeMutablePointer.allocate(capacity: 1) pointer.initialize(to: object) sequencedContents.append(pointer) } } public init(arrayLiteral elements: T...) { for object in elements where contents[object] == nil { contents[object] = contents.count let pointer = UnsafeMutablePointer.allocate(capacity: 1) pointer.initialize(to: object) sequencedContents.append(pointer) } } /** Locate the index of an object in the ordered set. It is preferable to use this method over the global find() for performance reasons. - parameter object: The object to find the index for. - returns: The index of the object, or nil if the object is not in the ordered set. */ public func index(of object: T) -> Index? { if let index = contents[object] { return index } return nil } /** Appends an object to the end of the ordered set. - parameter object: The object to be appended. */ public mutating func append(_ object: T) { if let lastIndex = index(of: object) { remove(object) insert(object, at: lastIndex) } else { contents[object] = contents.count if !isKnownUniquelyReferenced(&sequencedContents) { sequencedContents = sequencedContents.copy() } let pointer = UnsafeMutablePointer.allocate(capacity: 1) pointer.initialize(to: object) sequencedContents.append(pointer) } } /** Appends a sequence of objects to the end of the ordered set. - parameter sequence: The sequence of objects to be appended. */ public mutating func append(contentsOf sequence: S) where S.Iterator.Element == T { var gen = sequence.makeIterator() while let object: T = gen.next() { append(object) } } /** Removes an object from the ordered set. If the object exists in the ordered set, it will be removed. If it is not the last object in the ordered set, subsequent objects will be shifted down one position. - parameter object: The object to be removed. - returns: The former index position of the object. */ @discardableResult public mutating func remove(_ object: T) -> Index? { if let index = contents[object] { contents[object] = nil if !isKnownUniquelyReferenced(&sequencedContents) { sequencedContents = sequencedContents.copy() } sequencedContents[index].deinitialize(count: 1) sequencedContents[index].deallocate() sequencedContents.remove(at: index) for (object, i) in contents { if i < index { continue } contents[object] = i - 1 } return index } return nil } /** Removes the given objects from the ordered set. - parameter objects: The objects to be removed. - returns: A collection of the former index positions of the objects. An index position is not provided for objects that were not found. */ @discardableResult public mutating func remove(_ objects: S) -> [Index]? where S.Iterator.Element == T { var indexes = [Index]() objects.forEach { object in if let index = index(of: object) { indexes.append(index) } } var gen = objects.makeIterator() while let object: T = gen.next() { remove(object) } return indexes } /** Removes an object at a given index. This method will cause a fatal error if you attempt to move an object to an index that is out of bounds. - parameter index: The index of the object to be removed. */ public mutating func removeObject(at index: Index) { if index < 0 || index >= count { fatalError("Attempting to remove an object at an index that does not exist") } remove(sequencedContents[index].pointee) } /** Removes all objects that satisfy the given predicate in the ordered set. - parameter shouldBeRemoved: A closure that takes an object in the ordered set as its argument and returns a Boolean value indicating whether the object should be removed from the ordered set. - returns: The objects that were removed from the ordered set. */ @discardableResult public mutating func removeAllObjects(where shouldBeRemoved: (T) -> Bool) -> OrderedSet { var removedObjects = OrderedSet() var pointers = sequencedContents.pointers.makeIterator() while let object = pointers.next()?.pointee { if shouldBeRemoved(object) { remove(object) removedObjects.append(object) } } return removedObjects } /** Removes all objects in the ordered set. */ public mutating func removeAllObjects() { contents.removeAll() if !isKnownUniquelyReferenced(&sequencedContents) { sequencedContents = sequencedContents.copy() } for sequencedContent in sequencedContents.pointers { sequencedContent.deinitialize(count: 1) sequencedContent.deallocate() } sequencedContents.removeAll() } /** Swaps two objects contained within the ordered set. Both objects must exist within the set, or the swap will not occur. - parameter first: The first object to be swapped. - parameter second: The second object to be swapped. */ public mutating func swapObject(_ first: T, with second: T) { if let firstPosition = contents[first] { if let secondPosition = contents[second] { contents[first] = secondPosition contents[second] = firstPosition if !isKnownUniquelyReferenced(&sequencedContents) { sequencedContents = sequencedContents.copy() } sequencedContents[firstPosition].pointee = second sequencedContents[secondPosition].pointee = first } } } /** Tests if the ordered set contains any objects within a sequence. - parameter other: The sequence to look for the intersection in. - returns: Returns true if the sequence and set contain any equal objects, otherwise false. */ public func intersects(_ other: S) -> Bool where S.Iterator.Element == T { var gen = other.makeIterator() while let object: T = gen.next() { if contains(object) { return true } } return false } /** Tests if a the ordered set is a subset of another sequence. - parameter sequence: The sequence to check. - returns: true if the sequence contains all objects contained in the receiver, otherwise false. */ public func isSubset(of sequence: S) -> Bool where S.Iterator.Element == T { for (object, _) in contents { if !sequence.contains(object) { return false } } return true } /** Moves an object to a different index, shifting all objects in between the movement. This method is a no-op if the object doesn't exist in the set or the index is the same that the object is currently at. This method will cause a fatal error if you attempt to move an object to an index that is out of bounds. - parameter object: The object to be moved - parameter index: The index that the object should be moved to. */ public mutating func moveObject(_ object: T, toIndex index: Index) { if index < 0 || index >= count { fatalError("Attempting to move an object at an index that does not exist") } if let position = contents[object] { // Return if the client attempted to move to the current index if position == index { return } let adjustment = position > index ? -1 : 1 if !isKnownUniquelyReferenced(&sequencedContents) { sequencedContents = sequencedContents.copy() } var currentIndex = position while currentIndex != index { let nextIndex = currentIndex + adjustment let firstObject = sequencedContents[currentIndex].pointee let secondObject = sequencedContents[nextIndex].pointee sequencedContents[currentIndex].pointee = secondObject sequencedContents[nextIndex].pointee = firstObject contents[firstObject] = nextIndex contents[secondObject] = currentIndex currentIndex += adjustment } } } /** Moves an object from one index to a different index, shifting all objects in between the movement. This method is a no-op if the index is the same that the object is currently at. This method will cause a fatal error if you attempt to move an object fro man index that is out of bounds or to an index that is out of bounds. - parameter index: The index of the object to be moved. - parameter toIndex: The index that the object should be moved to. */ public mutating func moveObject(at index: Index, to toIndex: Index) { if (index < 0 || index >= count) || (toIndex < 0 || toIndex >= count) { fatalError("Attempting to move an object at or to an index that does not exist") } moveObject(self[index], toIndex: toIndex) } /** Inserts an object at a given index, shifting all objects above it up one. This method will cause a fatal error if you attempt to insert the object out of bounds. If the object already exists in the OrderedSet, this operation is a no-op. - parameter object: The object to be inserted. - parameter index: The index to be inserted at. */ public mutating func insert(_ object: T, at index: Index) { if index > count || index < 0 { fatalError("Attempting to insert an object at an index that does not exist") } if contents[object] != nil { return } // Append our object, then swap them until its at the end. append(object) for i in (index..(_ objects: S, at index: Index) where S.Iterator.Element == T { if index > count || index < 0 { fatalError("Attempting to insert an object at an index that does not exist") } var addedObjectCount = 0 if !isKnownUniquelyReferenced(&sequencedContents) { sequencedContents = sequencedContents.copy() } for object in objects where contents[object] == nil { let seqIdx = index + addedObjectCount let element = UnsafeMutablePointer.allocate(capacity: 1) element.initialize(to: object) sequencedContents.insert(element, at: seqIdx) contents[object] = seqIdx addedObjectCount += 1 } // Now we'll remove duplicates and update the shifted objects position in the contents // dictionary. for i in index + addedObjectCount.. 0 else { return nil } return sequencedContents[0].pointee } public func index(after index: Int) -> Int { return sequencedContents.index(after: index) } public typealias Index = Int public var startIndex: Int { return 0 } public var endIndex: Int { return contents.count } public subscript(index: Index) -> T { get { return sequencedContents[index].pointee } set { if !isKnownUniquelyReferenced(&sequencedContents) { sequencedContents = sequencedContents.copy() } let previousCount = contents.count contents[sequencedContents[index].pointee] = nil contents[newValue] = index // If the count is reduced we used an existing value, and need to sync up sequencedContents if contents.count == previousCount { sequencedContents[index].pointee = newValue } else { sequencedContents[index].deinitialize(count: 1) sequencedContents[index].deallocate() sequencedContents.remove(at: index) } } } } public func + (lhs: OrderedSet, rhs: S) -> OrderedSet where S.Element == T { var joinedSet = lhs joinedSet.append(contentsOf: rhs) return joinedSet } public func += (lhs: inout OrderedSet, rhs: S) where S.Element == T { lhs.append(contentsOf: rhs) } public func - (lhs: OrderedSet, rhs: S) -> OrderedSet where S.Element == T { var purgedSet = lhs purgedSet.remove(rhs) return purgedSet } public func -= (lhs: inout OrderedSet, rhs: S) where S.Element == T { lhs.remove(rhs) } extension OrderedSet: Equatable { } public func == (lhs: OrderedSet, rhs: OrderedSet) -> Bool { if lhs.count != rhs.count { return false } for object in lhs where lhs.contents[object] != rhs.contents[object] { return false } return true } extension OrderedSet: CustomStringConvertible { public var description: String { let children = map({ "\($0)" }).joined(separator: ", ") return "OrderedSet (\(count) object(s)): [\(children)]" } } extension OrderedSet: RandomAccessCollection {}