├── .github └── FUNDING.yml ├── .gitignore ├── .swift-version ├── .travis.yml ├── .travis ├── build-example.sh ├── build.sh ├── generate-docs.sh ├── install-cocoapods.sh ├── install-jazzy.sh └── install-swift.sh ├── CHANGELOG.md ├── LICENSE ├── Package.swift ├── README.md ├── Source ├── SwiftLCS Example │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ └── ViewController.swift └── SwiftLCS │ ├── Info-tvOS.plist │ ├── Info.plist │ ├── SwiftLCS.h │ └── SwiftLCS.swift ├── SwiftLCS Example.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ └── SwiftLCS Example.xcscheme ├── SwiftLCS.podspec ├── SwiftLCS.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ ├── SwiftLCS OSX.xcscheme │ ├── SwiftLCS iOS.xcscheme │ ├── SwiftLCS tvOS.xcscheme │ └── SwiftLCS watchOS.xcscheme ├── SwiftLCS.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ └── IDEWorkspaceChecks.plist └── Tests ├── LinuxMain.swift └── SwiftLCS Tests ├── ArrayTests.swift ├── BenchmarkTests.swift ├── IndexTests.swift ├── Info.plist ├── LinkedListTests.swift ├── StringTests.swift └── XCTestManifests.swift /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: ['https://www.buymeacoffee.com/frugghi'] 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | *.DS_Store 3 | .AppleDouble 4 | .LSOverride 5 | 6 | # Icon must end with two \r 7 | Icon 8 | 9 | 10 | # Thumbnails 11 | ._* 12 | 13 | # Files that might appear in the root of a volume 14 | .DocumentRevisions-V100 15 | .fseventsd 16 | .Spotlight-V100 17 | .TemporaryItems 18 | .Trashes 19 | .VolumeIcon.icns 20 | .com.apple.timemachine.donotpresent 21 | 22 | # Directories potentially created on remote AFP share 23 | .AppleDB 24 | .AppleDesktop 25 | Network Trash Folder 26 | Temporary Items 27 | .apdisk 28 | 29 | # jazzy documentation 30 | docs/ 31 | 32 | # Xcode 33 | # 34 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 35 | 36 | ## Build generated 37 | build/ 38 | DerivedData/ 39 | 40 | ## Various settings 41 | *.pbxuser 42 | !default.pbxuser 43 | *.mode1v3 44 | !default.mode1v3 45 | *.mode2v3 46 | !default.mode2v3 47 | *.perspectivev3 48 | !default.perspectivev3 49 | xcuserdata/ 50 | 51 | ## Other 52 | *.moved-aside 53 | *.xcuserstate 54 | 55 | ## Obj-C/Swift specific 56 | *.hmap 57 | *.ipa 58 | *.dSYM.zip 59 | *.dSYM 60 | 61 | ## Playgrounds 62 | timeline.xctimeline 63 | playground.xcworkspace 64 | 65 | # Swift Package Manager 66 | # 67 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 68 | # Packages/ 69 | .build/ 70 | 71 | # CocoaPods 72 | # 73 | # We recommend against adding the Pods directory to your .gitignore. However 74 | # you should judge for yourself, the pros and cons are mentioned at: 75 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 76 | # 77 | # Pods/ 78 | 79 | # Carthage 80 | # 81 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 82 | # Carthage/Checkouts 83 | 84 | Carthage/Build 85 | 86 | # fastlane 87 | # 88 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 89 | # screenshots whenever they are needed. 90 | # For more information about the recommended setup visit: 91 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 92 | 93 | fastlane/report.xml 94 | fastlane/Preview.html 95 | fastlane/screenshots 96 | fastlane/test_output -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 5.0 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | osx_image: xcode10.2 3 | dist: trusty 4 | notifications: 5 | email: false 6 | env: 7 | global: 8 | - LC_CTYPE=en_US.UTF-8 9 | - LANG=en_US.UTF-8 10 | - WORKSPACE=SwiftLCS.xcworkspace 11 | - IOS_FRAMEWORK_SCHEME="SwiftLCS iOS" 12 | - OSX_FRAMEWORK_SCHEME="SwiftLCS OSX" 13 | - TVOS_FRAMEWORK_SCHEME="SwiftLCS tvOS" 14 | - WATCHOS_FRAMEWORK_SCHEME="SwiftLCS watchOS" 15 | - IOS_SDK=iphonesimulator12.2 16 | - OSX_SDK=macosx10.14 17 | - TVOS_SDK=appletvsimulator12.2 18 | - WATCHOS_SDK=watchsimulator5.2 19 | - EXAMPLE_SCHEME="SwiftLCS Example" 20 | - PODSPEC_PATH="SwiftLCS.podspec" 21 | - SWIFTENV_ROOT="$HOME/.swiftenv" 22 | - PATH="$SWIFTENV_ROOT/bin:$SWIFTENV_ROOT/shims:$PATH" 23 | matrix: 24 | include: 25 | - os: osx 26 | env: DESTINATION="OS=5.0,name=Apple Watch Series 4 - 44mm" SCHEME="$WATCHOS_FRAMEWORK_SCHEME" SDK="$WATCHOS_SDK" RUN_TESTS="NO" BUILD_EXAMPLE="NO" GENERATE_DOC="NO" 27 | - os: osx 28 | env: DESTINATION="OS=12.0,name=iPhone 7 Plus" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" GENERATE_DOC="NO" 29 | - os: osx 30 | env: DESTINATION="OS=8.1,name=iPhone 5" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="NO" BUILD_EXAMPLE="NO" GENERATE_DOC="NO" 31 | - os: osx 32 | env: DESTINATION="OS=12.0,name=Apple TV 4K" SCHEME="$TVOS_FRAMEWORK_SCHEME" SDK="$TVOS_SDK" RUN_TESTS="NO" BUILD_EXAMPLE="NO" GENERATE_DOC="YES" 33 | - os: osx 34 | env: DESTINATION="arch=x86_64" SCHEME="$OSX_FRAMEWORK_SCHEME" SDK="$OSX_SDK" RUN_TESTS="NO" BUILD_EXAMPLE="NO" GENERATE_DOC="NO" 35 | - os: linux 36 | sudo: required 37 | language: generic 38 | before_install: 39 | - .travis/install-cocoapods.sh 40 | - .travis/install-jazzy.sh 41 | install: 42 | - .travis/install-swift.sh 43 | script: 44 | - .travis/build.sh debug "$SCHEME" 45 | - .travis/build.sh release "$SCHEME" 46 | - .travis/build-example.sh debug "$EXAMPLE_SCHEME" 47 | - .travis/generate-docs.sh 48 | deploy: 49 | provider: pages 50 | skip-cleanup: true 51 | github-token: $GITHUB_TOKEN 52 | keep-history: false 53 | local-dir: docs/ 54 | on: 55 | branch: master 56 | target-branch: gh-pages 57 | condition: "$GENERATE_DOC = YES" 58 | -------------------------------------------------------------------------------- /.travis/build-example.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o pipefail 4 | 5 | function build_osx { 6 | xcodebuild -workspace "${WORKSPACE}" -scheme "$2" -sdk "${SDK}" -destination "${DESTINATION}" -configuration "$1" ONLY_ACTIVE_ARCH=NO | xcpretty -c; 7 | } 8 | 9 | if [[ "${BUILD_EXAMPLE}" != "YES" ]]; then 10 | exit 0 11 | fi 12 | 13 | if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then 14 | build_osx "$1" "$2" 15 | fi 16 | -------------------------------------------------------------------------------- /.travis/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o pipefail 4 | 5 | function build_osx { 6 | xcodebuild -workspace "${WORKSPACE}" -scheme "$2" -sdk "${SDK}" -destination "${DESTINATION}" -configuration "$1" ONLY_ACTIVE_ARCH=NO "${@:3}" | xcpretty -c; 7 | } 8 | 9 | function build_linux { 10 | swiftenv version 11 | swift build --configuration "$1" 12 | } 13 | 14 | ARGS=() 15 | if [ "${RUN_TESTS}" == "YES" ]; then 16 | ARGS+=(ENABLE_TESTABILITY=YES test) 17 | fi 18 | 19 | if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then 20 | build_osx "$1" "$2" "${ARGS[@]}" 21 | elif [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then 22 | build_linux "$1" 23 | else 24 | echo "Unknown OS: ${TRAVIS_OS_NAME}" 25 | exit 1 26 | fi 27 | -------------------------------------------------------------------------------- /.travis/generate-docs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [[ "${GENERATE_DOC}" != "YES" ]]; then 4 | exit 0 5 | fi 6 | 7 | jazzy \ 8 | --clean \ 9 | --podspec "${PODSPEC_PATH}" \ 10 | --output "docs/" 11 | -------------------------------------------------------------------------------- /.travis/install-cocoapods.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then 4 | gem install cocoapods --no-document --quiet 5 | fi 6 | -------------------------------------------------------------------------------- /.travis/install-jazzy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [[ "${TRAVIS_OS_NAME}" == "osx" && "${GENERATE_DOC}" == "YES" ]]; then 4 | gem install jazzy --no-document --quiet 5 | fi 6 | -------------------------------------------------------------------------------- /.travis/install-swift.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then 4 | eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" 5 | swiftenv version 6 | fi 7 | 8 | swift --version 9 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 1.1.1 (2017-03-24) 4 | 5 | ##### Breaking 6 | 7 | * None. 8 | 9 | ##### Enhancements 10 | 11 | * None. 12 | 13 | ##### Bug Fixes 14 | 15 | * Fix issue where `addedIndexes` could contain the same index multiple times. 16 | [RaimarT](https://github.com/RaimarT) 17 | [#4](https://github.com/Frugghi/SwiftLCS/issues/4) 18 | 19 | ## 1.1 (2016-09-18) 20 | 21 | ##### Breaking 22 | 23 | * None. 24 | 25 | ##### Enhancements 26 | 27 | * Support for Swift 3. 28 | * Improve performances. 29 | 30 | ##### Bug Fixes 31 | 32 | * None. 33 | 34 | ## 1.0.1 (2016-04-25) 35 | 36 | ##### Breaking 37 | 38 | * None. 39 | 40 | ##### Enhancements 41 | 42 | * None. 43 | 44 | ##### Bug Fixes 45 | 46 | * Fix Swift 3 warnings. 47 | 48 | ## 1.0 (2015-10-19) 49 | 50 | #### CollectionType extension: 51 | An extension of `CollectionType`, which calculates the diff between two collections. 52 | * `diff()` returns the diff between two collections. 53 | 54 | #### RangeReplaceableCollectionType extension: 55 | An extension of `RangeReplaceableCollectionType`, which calculates the longest common subsequence between two collections. 56 | * `longestCommonSubsequence()` returns the longest common subsequence between two collections. 57 | 58 | #### String extension: 59 | An extension of `String`, which calculates the longest common subsequence between two strings. 60 | * `longestCommonSubsequence()` returns the longest common subsequence between two strings. 61 | 62 | #### Diff struct: 63 | A generic struct that represents a diff between two collections. 64 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Tommaso Madonia 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.0 2 | // 3 | // The MIT License (MIT) 4 | // 5 | // Copyright (c) 2015 Tommaso Madonia 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | // SOFTWARE. 24 | // 25 | 26 | import PackageDescription 27 | 28 | let package = Package( 29 | name: "SwiftLCS", 30 | products: [ 31 | .library(name: "SwiftLCS", targets: ["SwiftLCS"]) 32 | ], 33 | targets: [ 34 | .target(name: "SwiftLCS", dependencies: []), 35 | .testTarget(name: "SwiftLCS Tests", dependencies: ["SwiftLCS"]) 36 | ], 37 | swiftLanguageVersions: [.v4_2, .v5] 38 | ) 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SwiftLCS 2 | [![Build Status](https://travis-ci.org/Frugghi/SwiftLCS.svg?branch=master)](https://travis-ci.org/Frugghi/SwiftLCS) 3 | [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 4 | [![Pods](https://img.shields.io/cocoapods/v/SwiftLCS.svg)](https://cocoapods.org/pods/SwiftLCS) 5 | [![Pod platforms](https://img.shields.io/cocoapods/p/SwiftLCS.svg)](https://cocoapods.org/pods/SwiftLCS) 6 | 7 | SwitLCS provides an extension of `Collection` that finds the indexes of the longest common subsequence with another collection. 8 | 9 | The **longest common subsequence** (LCS) problem is the problem of finding the longest subsequence common to all sequences in a set of sequences (often just two sequences). It differs from problems of finding common substrings: unlike substrings, subsequences are not required to occupy consecutive positions within the original sequences. 10 | 11 | The project is based on the Objective-C implementation of [NSArray+LongestCommonSubsequence](https://github.com/khanlou/NSArray-LongestCommonSubsequence). 12 | 13 | ## :package: Installation 14 | 15 | ### CocoaPods 16 | [CocoaPods](https://cocoapods.org) is the dependency manager for Swift and Objective-C Cocoa projects. It has over ten thousand libraries and can help you scale your projects elegantly. 17 | 18 | Add this to your *Podfile*: 19 | ```Ruby 20 | use_frameworks! 21 | 22 | pod 'SwiftLCS' 23 | ``` 24 | 25 | ### Carthage 26 | [Carthage](https://github.com/Carthage/Carthage) builds your dependencies and provides you with binary frameworks, but you retain full control over your project structure and setup. 27 | 28 | Add this to your *Cartfile*: 29 | ```Ruby 30 | github "Frugghi/SwiftLCS" 31 | ``` 32 | 33 | ### Swift Package Manager 34 | The [Swift Package Manager](https://swift.org/package-manager/) is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies. 35 | 36 | Add `SwiftLCS` to your *Package.swift* dependencies: 37 | ```Swift 38 | import PackageDescription 39 | 40 | let package = Package( 41 | dependencies: [ 42 | .Package(url: "https://github.com/Frugghi/SwiftLCS.git", majorVersion: 1, minor: 3) 43 | ] 44 | ) 45 | ``` 46 | 47 | ### Manual 48 | Include `SwiftLCS.swift` into your project. 49 | 50 | ## :book: Documentation 51 | The API documentation is available [here](https://frugghi.github.io/SwiftLCS/). 52 | 53 | ## :computer: Usage 54 | Import the framework: 55 | ```Swift 56 | import SwiftLCS 57 | ``` 58 | 59 | ### String 60 | ```Swift 61 | let x = "abracadabra" 62 | let y = "yabbadabbadoo" 63 | 64 | let z = x.longestCommonSubsequence(y) // abadaba 65 | ``` 66 | 67 | ### Array 68 | ```Swift 69 | let x = [1, 2, 3, 4, 5, 6, 7] 70 | let y = [8, 9, 2, 10, 4, 11, 6, 12] 71 | 72 | let z = x.longestCommonSubsequence(y) // [2, 4, 6] 73 | ``` 74 | 75 | ### Indexes 76 | ```Swift 77 | let x = [1, 2, 3, 4, 5, 6, 7] 78 | let y = [8, 9, 2, 10, 4, 11, 6, 12] 79 | 80 | let diff = x.diff(y) 81 | // diff.commonIndexes: [1, 3, 5] 82 | // diff.addedIndexes: [0, 1, 3, 5, 7] 83 | // diff.removedIndexes: [0, 2, 4, 6] 84 | ``` 85 | 86 | ## :warning: Objective-C 87 | [Object comparison](https://developer.apple.com/library/content/documentation/General/Conceptual/DevPedia-CocoaCore/ObjectComparison.html) of Objective-C objects is done through the `isEquals:` method, so be sure that the implementations is correct otherwise `SwiftLCS` will not return the correct indexes. 88 | 89 | ## :page_facing_up: License [![LICENSE](https://img.shields.io/cocoapods/l/SwiftLCS.svg)](https://raw.githubusercontent.com/Frugghi/SwiftLCS/master/LICENSE) 90 | *SwiftLCS* is released under the MIT license. See [LICENSE](https://raw.githubusercontent.com/Frugghi/SwiftLCS/master/LICENSE) for details. 91 | -------------------------------------------------------------------------------- /Source/SwiftLCS Example/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // The MIT License (MIT) 3 | // 4 | // Copyright (c) 2015 Tommaso Madonia 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | 25 | import UIKit 26 | 27 | @UIApplicationMain 28 | class AppDelegate: UIResponder, UIApplicationDelegate { 29 | 30 | var window: UIWindow? 31 | 32 | 33 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 34 | // Override point for customization after application launch. 35 | return true 36 | } 37 | 38 | func applicationWillResignActive(_ application: UIApplication) { 39 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 40 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 41 | } 42 | 43 | func applicationDidEnterBackground(_ application: UIApplication) { 44 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 45 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 46 | } 47 | 48 | func applicationWillEnterForeground(_ application: UIApplication) { 49 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 50 | } 51 | 52 | func applicationDidBecomeActive(_ application: UIApplication) { 53 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 54 | } 55 | 56 | func applicationWillTerminate(_ application: UIApplication) { 57 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 58 | } 59 | 60 | 61 | } 62 | 63 | -------------------------------------------------------------------------------- /Source/SwiftLCS Example/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /Source/SwiftLCS Example/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Source/SwiftLCS Example/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /Source/SwiftLCS Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Source/SwiftLCS Example/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // The MIT License (MIT) 3 | // 4 | // Copyright (c) 2015 Tommaso Madonia 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | 25 | import UIKit 26 | import SwiftLCS 27 | 28 | class ViewController: UIViewController { 29 | 30 | @IBOutlet var firstTextField: UITextField! 31 | @IBOutlet var secondTextField: UITextField! 32 | @IBOutlet var resultTextField: UITextField! 33 | 34 | override func viewDidLoad() { 35 | super.viewDidLoad() 36 | // Do any additional setup after loading the view, typically from a nib. 37 | } 38 | 39 | @IBAction func textFieldChanged(_ sender: UITextField!) { 40 | guard let first = self.firstTextField.text, let second = self.secondTextField.text else { 41 | self.resultTextField.text = nil 42 | return 43 | } 44 | 45 | self.resultTextField.text = first.longestCommonSubsequence(second) 46 | } 47 | 48 | 49 | } 50 | 51 | -------------------------------------------------------------------------------- /Source/SwiftLCS/Info-tvOS.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSHumanReadableCopyright 22 | Copyright © 2016 Tommaso Madonia. All rights reserved. 23 | NSPrincipalClass 24 | 25 | UIRequiredDeviceCapabilities 26 | 27 | arm64 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Source/SwiftLCS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSHumanReadableCopyright 24 | Copyright © 2016 Tommaso Madonia. All rights reserved. 25 | NSPrincipalClass 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Source/SwiftLCS/SwiftLCS.h: -------------------------------------------------------------------------------- 1 | // 2 | // The MIT License (MIT) 3 | // 4 | // Copyright (c) 2015 Tommaso Madonia 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | 25 | @import Foundation; 26 | 27 | //! Project version number for SwiftLCS. 28 | FOUNDATION_EXPORT double SwiftLCSVersionNumber; 29 | 30 | //! Project version string for SwiftLCS. 31 | FOUNDATION_EXPORT const unsigned char SwiftLCSVersionString[]; 32 | -------------------------------------------------------------------------------- /Source/SwiftLCS/SwiftLCS.swift: -------------------------------------------------------------------------------- 1 | // 2 | // The MIT License (MIT) 3 | // 4 | // Copyright (c) 2015 Tommaso Madonia 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | 25 | import Foundation 26 | 27 | /// A generic struct that represents a diff between two collections. 28 | public struct Diff { 29 | 30 | /// The indexes whose corresponding values in the old collection are in the LCS. 31 | public var commonIndexes: [Index] { 32 | return self._commonIndexSet.indexes 33 | } 34 | 35 | /// The indexes whose corresponding values in the new collection are not in the LCS. 36 | public var addedIndexes: [Index] { 37 | return self._addedIndexSet.indexes 38 | } 39 | 40 | /// The indexes whose corresponding values in the old collection are not in the LCS. 41 | public var removedIndexes: [Index] { 42 | return self._removedIndexSet.indexes 43 | } 44 | 45 | /// Construct the `Diff` between two given collections. 46 | public init(_ old: C, _ new: C) where C.Index == Index, C.Element: Equatable { 47 | self = old.diff(new) 48 | } 49 | 50 | fileprivate let _commonIndexSet: DiffIndexSet 51 | fileprivate let _addedIndexSet: DiffIndexSet 52 | fileprivate let _removedIndexSet: DiffIndexSet 53 | 54 | fileprivate init(commonIndexes: DiffIndexSet, addedIndexes: DiffIndexSet, removedIndexes: DiffIndexSet) { 55 | self._commonIndexSet = commonIndexes 56 | self._addedIndexSet = addedIndexes 57 | self._removedIndexSet = removedIndexes 58 | } 59 | 60 | } 61 | 62 | /// An extension of `Diff`, which adds support for `IndexSet`. 63 | public extension Diff where Index: Strideable, Index.Stride: SignedInteger { 64 | 65 | /// The indexes whose corresponding values in the old collection are in the LCS. 66 | var commonIndexSet: IndexSet { 67 | return self._commonIndexSet.indexSet 68 | } 69 | 70 | /// The indexes whose corresponding values in the new collection are not in the LCS. 71 | var addedIndexSet: IndexSet { 72 | return self._addedIndexSet.indexSet 73 | } 74 | 75 | /// The indexes whose corresponding values in the old collection are not in the LCS. 76 | var removedIndexSet: IndexSet { 77 | return self._removedIndexSet.indexSet 78 | } 79 | 80 | } 81 | 82 | private struct DiffIndexSet { 83 | 84 | let startIndex: Index 85 | let indexes: [Index] 86 | 87 | init(_ indexes: [Index], startIndex: Index) { 88 | self.indexes = indexes 89 | self.startIndex = startIndex 90 | } 91 | 92 | } 93 | 94 | private extension DiffIndexSet where Index: Strideable, Index.Stride: SignedInteger { 95 | 96 | var indexSet: IndexSet { 97 | let indexes = self.indexes.map { Int(self.startIndex.distance(to: $0)) } 98 | 99 | return IndexSet(indexes) 100 | } 101 | 102 | } 103 | 104 | // MARK: - Collection - 105 | 106 | /// An extension of `Collection`, which calculates the diff between two collections. 107 | public extension Collection { 108 | 109 | /// Returns the diff between two collections. 110 | /// 111 | /// - Complexity: O(mn) where `m` and `n` are the lengths of the receiver and the given collection. 112 | /// - Parameter otherCollection: The collection with which to compare the receiver. 113 | /// - Returns: The diff between the receiver and the given collection. 114 | func diff(_ otherCollection: Self, by areEquivalent: (Element, Element) -> Bool) -> Diff { 115 | let commonIndexes = self.longestCommonSubsequence(otherCollection, by: areEquivalent) 116 | 117 | var removedIndexes: [Index] = [] 118 | removedIndexes.reserveCapacity(self.count - commonIndexes.count) 119 | 120 | var addedIndexes: [Index] = [] 121 | 122 | var index = self.startIndex 123 | var otherIndex = otherCollection.startIndex 124 | var commonIndexesIterator = commonIndexes.makeIterator() 125 | var commonIndex = commonIndexesIterator.next() 126 | while index != self.endIndex { 127 | if commonIndex == index { 128 | commonIndex = commonIndexesIterator.next() 129 | 130 | while otherIndex != otherCollection.endIndex && !areEquivalent(otherCollection[otherIndex], self[index]) { 131 | addedIndexes.append(otherIndex) 132 | otherIndex = otherCollection.index(after: otherIndex) 133 | } 134 | 135 | if otherIndex != otherCollection.endIndex { 136 | otherIndex = otherCollection.index(after: otherIndex) 137 | } 138 | } else { 139 | removedIndexes.append(index) 140 | } 141 | 142 | index = self.index(after: index) 143 | } 144 | 145 | while otherIndex != otherCollection.endIndex { 146 | addedIndexes.append(otherIndex) 147 | otherIndex = otherCollection.index(after: otherIndex) 148 | } 149 | 150 | return Diff(commonIndexes: DiffIndexSet(commonIndexes, startIndex: self.startIndex), 151 | addedIndexes: DiffIndexSet(addedIndexes, startIndex: otherCollection.startIndex), 152 | removedIndexes: DiffIndexSet(removedIndexes, startIndex: self.startIndex)) 153 | } 154 | 155 | } 156 | 157 | /// An extension of `Collection`, which calculates the diff between two collections. 158 | public extension Collection where Element: Equatable { 159 | 160 | /// Returns the diff between two collections. 161 | /// 162 | /// - Complexity: O(mn) where `m` and `n` are the lengths of the receiver and the given collection. 163 | /// - Parameters: 164 | /// - otherCollection: The collection with which to compare the receiver. 165 | /// - Returns: The diff between the receiver and the given collection. 166 | func diff(_ otherCollection: Self) -> Diff { 167 | return self.diff(otherCollection, by: ==) 168 | } 169 | 170 | } 171 | 172 | fileprivate extension Collection { 173 | 174 | func prefix(_ otherCollection: Self, count: Int, suffix: Int, by areEquivalent: (Element, Element) -> Bool) -> (Int, [Index]) { 175 | var iterator = self.makeIterator() 176 | var otherIterator = otherCollection.makeIterator() 177 | 178 | var prefix = self.startIndex 179 | let endIndex = self.index(self.startIndex, offsetBy: count - suffix) 180 | while let lhs = iterator.next(), let rhs = otherIterator.next(), prefix < endIndex && areEquivalent(lhs, rhs) { 181 | prefix = self.index(after: prefix) 182 | } 183 | 184 | let prefixLength = self.distance(from: self.startIndex, to: prefix) 185 | return (prefixLength, Array(self.indices.prefix(prefixLength))) 186 | } 187 | 188 | func suffix(_ otherCollection: Self, count: Int, by areEquivalent: (Element, Element) -> Bool) -> (Int, [Index]) { 189 | var iterator = self.reversed().makeIterator() 190 | var otherIterator = otherCollection.reversed().makeIterator() 191 | 192 | var offset = count 193 | var suffix = self.index(self.startIndex, offsetBy: offset) 194 | while let lhs = iterator.next(), let rhs = otherIterator.next(), areEquivalent(lhs, rhs) { 195 | offset &-= 1 196 | suffix = self.index(self.startIndex, offsetBy: offset) 197 | } 198 | 199 | let suffixLength = self.distance(from: suffix, to: self.endIndex) 200 | return (suffixLength, Array(self.indices.suffix(suffixLength))) 201 | } 202 | 203 | func computeLCS(_ otherCollection: Self, prefixLength: Int, suffixLength: Int, count: Int, by areEquivalent: (Element, Element) -> Bool) -> [Index] { 204 | let rows = Int(count - prefixLength - suffixLength) + 1 205 | let columns = Int(otherCollection.count - prefixLength - suffixLength) + 1 206 | 207 | guard rows > 1 && columns > 1 else { 208 | return [] 209 | } 210 | 211 | var lengths = Array(repeating: 0, count: rows * columns) 212 | var index = self.index(self.startIndex, offsetBy: prefixLength) 213 | for i in 0.. Bool) -> [Index] { 254 | let count = self.count 255 | let (suffix, suffixIndexes) = self.suffix(otherCollection, count: count, by: areEquivalent) 256 | let (prefix, prefixIndexes) = self.prefix(otherCollection, count: count, suffix: suffix, by: areEquivalent) 257 | 258 | return prefixIndexes + self.computeLCS(otherCollection, prefixLength: prefix, suffixLength: suffix, count: count, by: areEquivalent) + suffixIndexes 259 | } 260 | 261 | } 262 | 263 | // MARK: - Range replaceable collection - 264 | 265 | /// An extension of `RangeReplaceableCollection`, which calculates the longest common subsequence between two collections. 266 | public extension RangeReplaceableCollection { 267 | 268 | /// Returns the longest common subsequence between two collections. 269 | /// 270 | /// - Parameters: 271 | /// - collection: The collection with which to compare the receiver. 272 | /// - areEquivalent: A closure that returns a Boolean value indicating whether two elements are equivalent. 273 | /// - Returns: The longest common subsequence between the receiver and the given collection. 274 | func longestCommonSubsequence(_ collection: Self, by areEquivalent: (Element, Element) -> Bool) -> Self { 275 | return Self(self.longestCommonSubsequence(collection, by: areEquivalent).lazy.map { self[$0] }) 276 | } 277 | 278 | } 279 | 280 | /// An extension of `RangeReplaceableCollection`, which calculates the longest common subsequence between two collections. 281 | public extension RangeReplaceableCollection where Element: Equatable { 282 | 283 | /// Returns the longest common subsequence between two collections. 284 | /// 285 | /// - Parameters: 286 | /// - collection: The collection with which to compare the receiver. 287 | /// - Returns: The longest common subsequence between the receiver and the given collection. 288 | func longestCommonSubsequence(_ collection: Self) -> Self { 289 | return Self(self.longestCommonSubsequence(collection, by: ==).lazy.map { self[$0] }) 290 | } 291 | 292 | } 293 | -------------------------------------------------------------------------------- /SwiftLCS Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 18BCD1291D8B7DBE00B6E4B5 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18BCD1281D8B7DBE00B6E4B5 /* AppDelegate.swift */; }; 11 | 18BCD12B1D8B7DBE00B6E4B5 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18BCD12A1D8B7DBE00B6E4B5 /* ViewController.swift */; }; 12 | 18BCD12E1D8B7DBE00B6E4B5 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 18BCD12C1D8B7DBE00B6E4B5 /* Main.storyboard */; }; 13 | 18BCD1301D8B7DBE00B6E4B5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 18BCD12F1D8B7DBE00B6E4B5 /* Assets.xcassets */; }; 14 | 18BCD1331D8B7DBE00B6E4B5 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 18BCD1311D8B7DBE00B6E4B5 /* LaunchScreen.storyboard */; }; 15 | 18BCD1571D8B7E8000B6E4B5 /* SwiftLCS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 18BCD14E1D8B7E6D00B6E4B5 /* SwiftLCS.framework */; }; 16 | 18BCD1591D8B7EA500B6E4B5 /* SwiftLCS.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 18BCD14E1D8B7E6D00B6E4B5 /* SwiftLCS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXContainerItemProxy section */ 20 | 18BCD14B1D8B7E6D00B6E4B5 /* PBXContainerItemProxy */ = { 21 | isa = PBXContainerItemProxy; 22 | containerPortal = 18BCD1401D8B7E6C00B6E4B5 /* SwiftLCS.xcodeproj */; 23 | proxyType = 2; 24 | remoteGlobalIDString = 1804B6661BCDE58000BD250F; 25 | remoteInfo = SwiftLCSTests; 26 | }; 27 | 18BCD14D1D8B7E6D00B6E4B5 /* PBXContainerItemProxy */ = { 28 | isa = PBXContainerItemProxy; 29 | containerPortal = 18BCD1401D8B7E6C00B6E4B5 /* SwiftLCS.xcodeproj */; 30 | proxyType = 2; 31 | remoteGlobalIDString = 182E30CF1BD4F44A008EC94E; 32 | remoteInfo = "SwiftLCS iOS"; 33 | }; 34 | 18BCD14F1D8B7E6D00B6E4B5 /* PBXContainerItemProxy */ = { 35 | isa = PBXContainerItemProxy; 36 | containerPortal = 18BCD1401D8B7E6C00B6E4B5 /* SwiftLCS.xcodeproj */; 37 | proxyType = 2; 38 | remoteGlobalIDString = 18BCD0EE1D8B6FB700B6E4B5; 39 | remoteInfo = "SwiftLCS watchOS"; 40 | }; 41 | 18BCD1511D8B7E6D00B6E4B5 /* PBXContainerItemProxy */ = { 42 | isa = PBXContainerItemProxy; 43 | containerPortal = 18BCD1401D8B7E6C00B6E4B5 /* SwiftLCS.xcodeproj */; 44 | proxyType = 2; 45 | remoteGlobalIDString = 18BCD0FE1D8B72F400B6E4B5; 46 | remoteInfo = "SwiftLCS tvOS"; 47 | }; 48 | 18BCD1531D8B7E6D00B6E4B5 /* PBXContainerItemProxy */ = { 49 | isa = PBXContainerItemProxy; 50 | containerPortal = 18BCD1401D8B7E6C00B6E4B5 /* SwiftLCS.xcodeproj */; 51 | proxyType = 2; 52 | remoteGlobalIDString = 18BCD1111D8B752200B6E4B5; 53 | remoteInfo = "SwiftLCS OSX"; 54 | }; 55 | 18BCD1551D8B7E7500B6E4B5 /* PBXContainerItemProxy */ = { 56 | isa = PBXContainerItemProxy; 57 | containerPortal = 18BCD1401D8B7E6C00B6E4B5 /* SwiftLCS.xcodeproj */; 58 | proxyType = 1; 59 | remoteGlobalIDString = 182E30CE1BD4F44A008EC94E; 60 | remoteInfo = "SwiftLCS iOS"; 61 | }; 62 | 18BCD15A1D8B7EA500B6E4B5 /* PBXContainerItemProxy */ = { 63 | isa = PBXContainerItemProxy; 64 | containerPortal = 18BCD1401D8B7E6C00B6E4B5 /* SwiftLCS.xcodeproj */; 65 | proxyType = 1; 66 | remoteGlobalIDString = 182E30CE1BD4F44A008EC94E; 67 | remoteInfo = "SwiftLCS iOS"; 68 | }; 69 | /* End PBXContainerItemProxy section */ 70 | 71 | /* Begin PBXCopyFilesBuildPhase section */ 72 | 18BCD15C1D8B7EA500B6E4B5 /* Embed Frameworks */ = { 73 | isa = PBXCopyFilesBuildPhase; 74 | buildActionMask = 2147483647; 75 | dstPath = ""; 76 | dstSubfolderSpec = 10; 77 | files = ( 78 | 18BCD1591D8B7EA500B6E4B5 /* SwiftLCS.framework in Embed Frameworks */, 79 | ); 80 | name = "Embed Frameworks"; 81 | runOnlyForDeploymentPostprocessing = 0; 82 | }; 83 | /* End PBXCopyFilesBuildPhase section */ 84 | 85 | /* Begin PBXFileReference section */ 86 | 18BCD1251D8B7DBE00B6E4B5 /* SwiftLCS Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "SwiftLCS Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 87 | 18BCD1281D8B7DBE00B6E4B5 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 88 | 18BCD12A1D8B7DBE00B6E4B5 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 89 | 18BCD12D1D8B7DBE00B6E4B5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 90 | 18BCD12F1D8B7DBE00B6E4B5 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 91 | 18BCD1321D8B7DBE00B6E4B5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 92 | 18BCD1341D8B7DBE00B6E4B5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 93 | 18BCD1401D8B7E6C00B6E4B5 /* SwiftLCS.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = SwiftLCS.xcodeproj; sourceTree = ""; }; 94 | /* End PBXFileReference section */ 95 | 96 | /* Begin PBXFrameworksBuildPhase section */ 97 | 18BCD1221D8B7DBE00B6E4B5 /* Frameworks */ = { 98 | isa = PBXFrameworksBuildPhase; 99 | buildActionMask = 2147483647; 100 | files = ( 101 | 18BCD1571D8B7E8000B6E4B5 /* SwiftLCS.framework in Frameworks */, 102 | ); 103 | runOnlyForDeploymentPostprocessing = 0; 104 | }; 105 | /* End PBXFrameworksBuildPhase section */ 106 | 107 | /* Begin PBXGroup section */ 108 | 18BCD11C1D8B7DBE00B6E4B5 = { 109 | isa = PBXGroup; 110 | children = ( 111 | 18BCD1401D8B7E6C00B6E4B5 /* SwiftLCS.xcodeproj */, 112 | 18BCD1271D8B7DBE00B6E4B5 /* SwiftLCS Example */, 113 | 18BCD1261D8B7DBE00B6E4B5 /* Products */, 114 | ); 115 | sourceTree = ""; 116 | }; 117 | 18BCD1261D8B7DBE00B6E4B5 /* Products */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 18BCD1251D8B7DBE00B6E4B5 /* SwiftLCS Example.app */, 121 | ); 122 | name = Products; 123 | sourceTree = ""; 124 | }; 125 | 18BCD1271D8B7DBE00B6E4B5 /* SwiftLCS Example */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | 18BCD1281D8B7DBE00B6E4B5 /* AppDelegate.swift */, 129 | 18BCD12A1D8B7DBE00B6E4B5 /* ViewController.swift */, 130 | 18BCD12C1D8B7DBE00B6E4B5 /* Main.storyboard */, 131 | 18BCD12F1D8B7DBE00B6E4B5 /* Assets.xcassets */, 132 | 18BCD1311D8B7DBE00B6E4B5 /* LaunchScreen.storyboard */, 133 | 18BCD1341D8B7DBE00B6E4B5 /* Info.plist */, 134 | ); 135 | name = "SwiftLCS Example"; 136 | path = "Source/SwiftLCS Example"; 137 | sourceTree = ""; 138 | }; 139 | 18BCD1411D8B7E6C00B6E4B5 /* Products */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | 18BCD14C1D8B7E6D00B6E4B5 /* SwiftLCS Tests.xctest */, 143 | 18BCD14E1D8B7E6D00B6E4B5 /* SwiftLCS.framework */, 144 | 18BCD1501D8B7E6D00B6E4B5 /* SwiftLCS.framework */, 145 | 18BCD1521D8B7E6D00B6E4B5 /* SwiftLCS.framework */, 146 | 18BCD1541D8B7E6D00B6E4B5 /* SwiftLCS.framework */, 147 | ); 148 | name = Products; 149 | sourceTree = ""; 150 | }; 151 | /* End PBXGroup section */ 152 | 153 | /* Begin PBXNativeTarget section */ 154 | 18BCD1241D8B7DBE00B6E4B5 /* SwiftLCS Example */ = { 155 | isa = PBXNativeTarget; 156 | buildConfigurationList = 18BCD1371D8B7DBE00B6E4B5 /* Build configuration list for PBXNativeTarget "SwiftLCS Example" */; 157 | buildPhases = ( 158 | 18BCD1211D8B7DBE00B6E4B5 /* Sources */, 159 | 18BCD1221D8B7DBE00B6E4B5 /* Frameworks */, 160 | 18BCD1231D8B7DBE00B6E4B5 /* Resources */, 161 | 18BCD15C1D8B7EA500B6E4B5 /* Embed Frameworks */, 162 | ); 163 | buildRules = ( 164 | ); 165 | dependencies = ( 166 | 18BCD1561D8B7E7500B6E4B5 /* PBXTargetDependency */, 167 | 18BCD15B1D8B7EA500B6E4B5 /* PBXTargetDependency */, 168 | ); 169 | name = "SwiftLCS Example"; 170 | productName = "SwiftLCS Example"; 171 | productReference = 18BCD1251D8B7DBE00B6E4B5 /* SwiftLCS Example.app */; 172 | productType = "com.apple.product-type.application"; 173 | }; 174 | /* End PBXNativeTarget section */ 175 | 176 | /* Begin PBXProject section */ 177 | 18BCD11D1D8B7DBE00B6E4B5 /* Project object */ = { 178 | isa = PBXProject; 179 | attributes = { 180 | LastSwiftUpdateCheck = 0800; 181 | LastUpgradeCheck = 1020; 182 | ORGANIZATIONNAME = "Tommaso Madonia"; 183 | TargetAttributes = { 184 | 18BCD1241D8B7DBE00B6E4B5 = { 185 | CreatedOnToolsVersion = 8.0; 186 | LastSwiftMigration = 1020; 187 | ProvisioningStyle = Automatic; 188 | }; 189 | }; 190 | }; 191 | buildConfigurationList = 18BCD1201D8B7DBE00B6E4B5 /* Build configuration list for PBXProject "SwiftLCS Example" */; 192 | compatibilityVersion = "Xcode 3.2"; 193 | developmentRegion = en; 194 | hasScannedForEncodings = 0; 195 | knownRegions = ( 196 | en, 197 | Base, 198 | ); 199 | mainGroup = 18BCD11C1D8B7DBE00B6E4B5; 200 | productRefGroup = 18BCD1261D8B7DBE00B6E4B5 /* Products */; 201 | projectDirPath = ""; 202 | projectReferences = ( 203 | { 204 | ProductGroup = 18BCD1411D8B7E6C00B6E4B5 /* Products */; 205 | ProjectRef = 18BCD1401D8B7E6C00B6E4B5 /* SwiftLCS.xcodeproj */; 206 | }, 207 | ); 208 | projectRoot = ""; 209 | targets = ( 210 | 18BCD1241D8B7DBE00B6E4B5 /* SwiftLCS Example */, 211 | ); 212 | }; 213 | /* End PBXProject section */ 214 | 215 | /* Begin PBXReferenceProxy section */ 216 | 18BCD14C1D8B7E6D00B6E4B5 /* SwiftLCS Tests.xctest */ = { 217 | isa = PBXReferenceProxy; 218 | fileType = wrapper.cfbundle; 219 | path = "SwiftLCS Tests.xctest"; 220 | remoteRef = 18BCD14B1D8B7E6D00B6E4B5 /* PBXContainerItemProxy */; 221 | sourceTree = BUILT_PRODUCTS_DIR; 222 | }; 223 | 18BCD14E1D8B7E6D00B6E4B5 /* SwiftLCS.framework */ = { 224 | isa = PBXReferenceProxy; 225 | fileType = wrapper.framework; 226 | path = SwiftLCS.framework; 227 | remoteRef = 18BCD14D1D8B7E6D00B6E4B5 /* PBXContainerItemProxy */; 228 | sourceTree = BUILT_PRODUCTS_DIR; 229 | }; 230 | 18BCD1501D8B7E6D00B6E4B5 /* SwiftLCS.framework */ = { 231 | isa = PBXReferenceProxy; 232 | fileType = wrapper.framework; 233 | path = SwiftLCS.framework; 234 | remoteRef = 18BCD14F1D8B7E6D00B6E4B5 /* PBXContainerItemProxy */; 235 | sourceTree = BUILT_PRODUCTS_DIR; 236 | }; 237 | 18BCD1521D8B7E6D00B6E4B5 /* SwiftLCS.framework */ = { 238 | isa = PBXReferenceProxy; 239 | fileType = wrapper.framework; 240 | path = SwiftLCS.framework; 241 | remoteRef = 18BCD1511D8B7E6D00B6E4B5 /* PBXContainerItemProxy */; 242 | sourceTree = BUILT_PRODUCTS_DIR; 243 | }; 244 | 18BCD1541D8B7E6D00B6E4B5 /* SwiftLCS.framework */ = { 245 | isa = PBXReferenceProxy; 246 | fileType = wrapper.framework; 247 | path = SwiftLCS.framework; 248 | remoteRef = 18BCD1531D8B7E6D00B6E4B5 /* PBXContainerItemProxy */; 249 | sourceTree = BUILT_PRODUCTS_DIR; 250 | }; 251 | /* End PBXReferenceProxy section */ 252 | 253 | /* Begin PBXResourcesBuildPhase section */ 254 | 18BCD1231D8B7DBE00B6E4B5 /* Resources */ = { 255 | isa = PBXResourcesBuildPhase; 256 | buildActionMask = 2147483647; 257 | files = ( 258 | 18BCD1331D8B7DBE00B6E4B5 /* LaunchScreen.storyboard in Resources */, 259 | 18BCD1301D8B7DBE00B6E4B5 /* Assets.xcassets in Resources */, 260 | 18BCD12E1D8B7DBE00B6E4B5 /* Main.storyboard in Resources */, 261 | ); 262 | runOnlyForDeploymentPostprocessing = 0; 263 | }; 264 | /* End PBXResourcesBuildPhase section */ 265 | 266 | /* Begin PBXSourcesBuildPhase section */ 267 | 18BCD1211D8B7DBE00B6E4B5 /* Sources */ = { 268 | isa = PBXSourcesBuildPhase; 269 | buildActionMask = 2147483647; 270 | files = ( 271 | 18BCD12B1D8B7DBE00B6E4B5 /* ViewController.swift in Sources */, 272 | 18BCD1291D8B7DBE00B6E4B5 /* AppDelegate.swift in Sources */, 273 | ); 274 | runOnlyForDeploymentPostprocessing = 0; 275 | }; 276 | /* End PBXSourcesBuildPhase section */ 277 | 278 | /* Begin PBXTargetDependency section */ 279 | 18BCD1561D8B7E7500B6E4B5 /* PBXTargetDependency */ = { 280 | isa = PBXTargetDependency; 281 | name = "SwiftLCS iOS"; 282 | targetProxy = 18BCD1551D8B7E7500B6E4B5 /* PBXContainerItemProxy */; 283 | }; 284 | 18BCD15B1D8B7EA500B6E4B5 /* PBXTargetDependency */ = { 285 | isa = PBXTargetDependency; 286 | name = "SwiftLCS iOS"; 287 | targetProxy = 18BCD15A1D8B7EA500B6E4B5 /* PBXContainerItemProxy */; 288 | }; 289 | /* End PBXTargetDependency section */ 290 | 291 | /* Begin PBXVariantGroup section */ 292 | 18BCD12C1D8B7DBE00B6E4B5 /* Main.storyboard */ = { 293 | isa = PBXVariantGroup; 294 | children = ( 295 | 18BCD12D1D8B7DBE00B6E4B5 /* Base */, 296 | ); 297 | name = Main.storyboard; 298 | sourceTree = ""; 299 | }; 300 | 18BCD1311D8B7DBE00B6E4B5 /* LaunchScreen.storyboard */ = { 301 | isa = PBXVariantGroup; 302 | children = ( 303 | 18BCD1321D8B7DBE00B6E4B5 /* Base */, 304 | ); 305 | name = LaunchScreen.storyboard; 306 | sourceTree = ""; 307 | }; 308 | /* End PBXVariantGroup section */ 309 | 310 | /* Begin XCBuildConfiguration section */ 311 | 18BCD1351D8B7DBE00B6E4B5 /* Debug */ = { 312 | isa = XCBuildConfiguration; 313 | buildSettings = { 314 | ALWAYS_SEARCH_USER_PATHS = NO; 315 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 316 | CLANG_ANALYZER_NONNULL = YES; 317 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 318 | CLANG_CXX_LIBRARY = "libc++"; 319 | CLANG_ENABLE_MODULES = YES; 320 | CLANG_ENABLE_OBJC_ARC = YES; 321 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 322 | CLANG_WARN_BOOL_CONVERSION = YES; 323 | CLANG_WARN_COMMA = YES; 324 | CLANG_WARN_CONSTANT_CONVERSION = YES; 325 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 326 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 327 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 328 | CLANG_WARN_EMPTY_BODY = YES; 329 | CLANG_WARN_ENUM_CONVERSION = YES; 330 | CLANG_WARN_INFINITE_RECURSION = YES; 331 | CLANG_WARN_INT_CONVERSION = YES; 332 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 333 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 334 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 335 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 336 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 337 | CLANG_WARN_STRICT_PROTOTYPES = YES; 338 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 339 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 340 | CLANG_WARN_UNREACHABLE_CODE = YES; 341 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 342 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 343 | COPY_PHASE_STRIP = NO; 344 | DEBUG_INFORMATION_FORMAT = dwarf; 345 | ENABLE_STRICT_OBJC_MSGSEND = YES; 346 | ENABLE_TESTABILITY = YES; 347 | GCC_C_LANGUAGE_STANDARD = gnu99; 348 | GCC_DYNAMIC_NO_PIC = NO; 349 | GCC_NO_COMMON_BLOCKS = YES; 350 | GCC_OPTIMIZATION_LEVEL = 0; 351 | GCC_PREPROCESSOR_DEFINITIONS = ( 352 | "DEBUG=1", 353 | "$(inherited)", 354 | ); 355 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 356 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 357 | GCC_WARN_UNDECLARED_SELECTOR = YES; 358 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 359 | GCC_WARN_UNUSED_FUNCTION = YES; 360 | GCC_WARN_UNUSED_VARIABLE = YES; 361 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 362 | MTL_ENABLE_DEBUG_INFO = YES; 363 | ONLY_ACTIVE_ARCH = YES; 364 | SDKROOT = iphoneos; 365 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 366 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 367 | }; 368 | name = Debug; 369 | }; 370 | 18BCD1361D8B7DBE00B6E4B5 /* Release */ = { 371 | isa = XCBuildConfiguration; 372 | buildSettings = { 373 | ALWAYS_SEARCH_USER_PATHS = NO; 374 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 375 | CLANG_ANALYZER_NONNULL = YES; 376 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 377 | CLANG_CXX_LIBRARY = "libc++"; 378 | CLANG_ENABLE_MODULES = YES; 379 | CLANG_ENABLE_OBJC_ARC = YES; 380 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 381 | CLANG_WARN_BOOL_CONVERSION = YES; 382 | CLANG_WARN_COMMA = YES; 383 | CLANG_WARN_CONSTANT_CONVERSION = YES; 384 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 385 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 386 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 387 | CLANG_WARN_EMPTY_BODY = YES; 388 | CLANG_WARN_ENUM_CONVERSION = YES; 389 | CLANG_WARN_INFINITE_RECURSION = YES; 390 | CLANG_WARN_INT_CONVERSION = YES; 391 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 392 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 393 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 394 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 395 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 396 | CLANG_WARN_STRICT_PROTOTYPES = YES; 397 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 398 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 399 | CLANG_WARN_UNREACHABLE_CODE = YES; 400 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 401 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 402 | COPY_PHASE_STRIP = NO; 403 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 404 | ENABLE_NS_ASSERTIONS = NO; 405 | ENABLE_STRICT_OBJC_MSGSEND = YES; 406 | GCC_C_LANGUAGE_STANDARD = gnu99; 407 | GCC_NO_COMMON_BLOCKS = YES; 408 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 409 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 410 | GCC_WARN_UNDECLARED_SELECTOR = YES; 411 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 412 | GCC_WARN_UNUSED_FUNCTION = YES; 413 | GCC_WARN_UNUSED_VARIABLE = YES; 414 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 415 | MTL_ENABLE_DEBUG_INFO = NO; 416 | SDKROOT = iphoneos; 417 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 418 | VALIDATE_PRODUCT = YES; 419 | }; 420 | name = Release; 421 | }; 422 | 18BCD1381D8B7DBE00B6E4B5 /* Debug */ = { 423 | isa = XCBuildConfiguration; 424 | buildSettings = { 425 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 426 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 427 | INFOPLIST_FILE = "Source/SwiftLCS Example/Info.plist"; 428 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 429 | PRODUCT_BUNDLE_IDENTIFIER = "com.tommasomadonia.SwiftLCS-Example"; 430 | PRODUCT_NAME = "$(TARGET_NAME)"; 431 | SWIFT_VERSION = 5.0; 432 | }; 433 | name = Debug; 434 | }; 435 | 18BCD1391D8B7DBE00B6E4B5 /* Release */ = { 436 | isa = XCBuildConfiguration; 437 | buildSettings = { 438 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 439 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 440 | INFOPLIST_FILE = "Source/SwiftLCS Example/Info.plist"; 441 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 442 | PRODUCT_BUNDLE_IDENTIFIER = "com.tommasomadonia.SwiftLCS-Example"; 443 | PRODUCT_NAME = "$(TARGET_NAME)"; 444 | SWIFT_VERSION = 5.0; 445 | }; 446 | name = Release; 447 | }; 448 | /* End XCBuildConfiguration section */ 449 | 450 | /* Begin XCConfigurationList section */ 451 | 18BCD1201D8B7DBE00B6E4B5 /* Build configuration list for PBXProject "SwiftLCS Example" */ = { 452 | isa = XCConfigurationList; 453 | buildConfigurations = ( 454 | 18BCD1351D8B7DBE00B6E4B5 /* Debug */, 455 | 18BCD1361D8B7DBE00B6E4B5 /* Release */, 456 | ); 457 | defaultConfigurationIsVisible = 0; 458 | defaultConfigurationName = Release; 459 | }; 460 | 18BCD1371D8B7DBE00B6E4B5 /* Build configuration list for PBXNativeTarget "SwiftLCS Example" */ = { 461 | isa = XCConfigurationList; 462 | buildConfigurations = ( 463 | 18BCD1381D8B7DBE00B6E4B5 /* Debug */, 464 | 18BCD1391D8B7DBE00B6E4B5 /* Release */, 465 | ); 466 | defaultConfigurationIsVisible = 0; 467 | defaultConfigurationName = Release; 468 | }; 469 | /* End XCConfigurationList section */ 470 | }; 471 | rootObject = 18BCD11D1D8B7DBE00B6E4B5 /* Project object */; 472 | } 473 | -------------------------------------------------------------------------------- /SwiftLCS Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SwiftLCS Example.xcodeproj/xcshareddata/xcschemes/SwiftLCS Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /SwiftLCS.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |spec| 2 | spec.name = 'SwiftLCS' 3 | spec.version = '1.3.5' 4 | spec.summary = 'SwiftLCS is a Swift implementation of longest common subsequence (LCS) algorithm.' 5 | spec.homepage = 'https://github.com/Frugghi/SwiftLCS' 6 | spec.license = 'MIT' 7 | spec.authors = { 'Tommaso Madonia' => 'tommaso@madonia.me' } 8 | spec.social_media_url = 'https://twitter.com/Frugghi' 9 | spec.source = { :git => 'https://github.com/Frugghi/SwiftLCS.git', :tag => spec.version.to_s } 10 | 11 | spec.requires_arc = true 12 | spec.swift_version = '5.0' 13 | spec.default_subspec = 'Core' 14 | 15 | spec.ios.deployment_target = '8.0' 16 | spec.osx.deployment_target = '10.10' 17 | spec.tvos.deployment_target = '9.0' 18 | spec.watchos.deployment_target = '2.0' 19 | 20 | spec.subspec 'Core' do |core| 21 | core.source_files = 'Source/SwiftLCS/SwiftLCS.swift' 22 | end 23 | 24 | #spec.test_spec do |test_spec| 25 | # test_spec.source_files = 'SwiftLCS Tests/*.swift' 26 | #end 27 | 28 | end 29 | -------------------------------------------------------------------------------- /SwiftLCS.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 182E30D21BD4F44A008EC94E /* SwiftLCS.h in Headers */ = {isa = PBXBuildFile; fileRef = 182E30D11BD4F44A008EC94E /* SwiftLCS.h */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | 182E30DD1BD4F46A008EC94E /* SwiftLCS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 182E30DB1BD4F46A008EC94E /* SwiftLCS.swift */; }; 12 | 182E30E11BD4F502008EC94E /* SwiftLCS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 182E30CF1BD4F44A008EC94E /* SwiftLCS.framework */; }; 13 | 1886DD141BCEC60900E67CD7 /* StringTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1886DD131BCEC60900E67CD7 /* StringTests.swift */; }; 14 | 1886DD161BCEC7FB00E67CD7 /* ArrayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1886DD151BCEC7FB00E67CD7 /* ArrayTests.swift */; }; 15 | 1886DD181BCECA3000E67CD7 /* IndexTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1886DD171BCECA3000E67CD7 /* IndexTests.swift */; }; 16 | 18BCD0F61D8B71BA00B6E4B5 /* SwiftLCS.h in Headers */ = {isa = PBXBuildFile; fileRef = 182E30D11BD4F44A008EC94E /* SwiftLCS.h */; settings = {ATTRIBUTES = (Public, ); }; }; 17 | 18BCD0F71D8B71C600B6E4B5 /* SwiftLCS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 182E30DB1BD4F46A008EC94E /* SwiftLCS.swift */; }; 18 | 18BCD1081D8B73F800B6E4B5 /* SwiftLCS.h in Headers */ = {isa = PBXBuildFile; fileRef = 182E30D11BD4F44A008EC94E /* SwiftLCS.h */; settings = {ATTRIBUTES = (Public, ); }; }; 19 | 18BCD1091D8B740200B6E4B5 /* SwiftLCS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 182E30DB1BD4F46A008EC94E /* SwiftLCS.swift */; }; 20 | 18BCD1191D8B757B00B6E4B5 /* SwiftLCS.h in Headers */ = {isa = PBXBuildFile; fileRef = 182E30D11BD4F44A008EC94E /* SwiftLCS.h */; settings = {ATTRIBUTES = (Public, ); }; }; 21 | 18BCD11A1D8B758200B6E4B5 /* SwiftLCS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 182E30DB1BD4F46A008EC94E /* SwiftLCS.swift */; }; 22 | 7D4B06042044EA7600C02F0E /* BenchmarkTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D4B06032044EA7600C02F0E /* BenchmarkTests.swift */; }; 23 | 7D4B06092044F85400C02F0E /* LinkedListTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D4B06082044F85400C02F0E /* LinkedListTests.swift */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXContainerItemProxy section */ 27 | 182E30DF1BD4F4FE008EC94E /* PBXContainerItemProxy */ = { 28 | isa = PBXContainerItemProxy; 29 | containerPortal = 1804B64A1BCDE57F00BD250F /* Project object */; 30 | proxyType = 1; 31 | remoteGlobalIDString = 182E30CE1BD4F44A008EC94E; 32 | remoteInfo = SwiftLCS; 33 | }; 34 | /* End PBXContainerItemProxy section */ 35 | 36 | /* Begin PBXFileReference section */ 37 | 1804B6661BCDE58000BD250F /* SwiftLCS Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SwiftLCS Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | 1804B66C1BCDE58000BD250F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 39 | 182E30CF1BD4F44A008EC94E /* SwiftLCS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftLCS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | 182E30D11BD4F44A008EC94E /* SwiftLCS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SwiftLCS.h; sourceTree = ""; }; 41 | 182E30D31BD4F44A008EC94E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 42 | 182E30DB1BD4F46A008EC94E /* SwiftLCS.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftLCS.swift; sourceTree = ""; }; 43 | 1886DD131BCEC60900E67CD7 /* StringTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StringTests.swift; sourceTree = ""; }; 44 | 1886DD151BCEC7FB00E67CD7 /* ArrayTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArrayTests.swift; sourceTree = ""; }; 45 | 1886DD171BCECA3000E67CD7 /* IndexTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IndexTests.swift; sourceTree = ""; }; 46 | 18BCD0EE1D8B6FB700B6E4B5 /* SwiftLCS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftLCS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 47 | 18BCD0FE1D8B72F400B6E4B5 /* SwiftLCS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftLCS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | 18BCD1061D8B73E000B6E4B5 /* Info-tvOS.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-tvOS.plist"; sourceTree = ""; }; 49 | 18BCD1111D8B752200B6E4B5 /* SwiftLCS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftLCS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | 7D4B06032044EA7600C02F0E /* BenchmarkTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BenchmarkTests.swift; sourceTree = ""; }; 51 | 7D4B06082044F85400C02F0E /* LinkedListTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkedListTests.swift; sourceTree = ""; }; 52 | /* End PBXFileReference section */ 53 | 54 | /* Begin PBXFrameworksBuildPhase section */ 55 | 1804B6631BCDE58000BD250F /* Frameworks */ = { 56 | isa = PBXFrameworksBuildPhase; 57 | buildActionMask = 2147483647; 58 | files = ( 59 | 182E30E11BD4F502008EC94E /* SwiftLCS.framework in Frameworks */, 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | 182E30CB1BD4F44A008EC94E /* Frameworks */ = { 64 | isa = PBXFrameworksBuildPhase; 65 | buildActionMask = 2147483647; 66 | files = ( 67 | ); 68 | runOnlyForDeploymentPostprocessing = 0; 69 | }; 70 | 18BCD0EA1D8B6FB700B6E4B5 /* Frameworks */ = { 71 | isa = PBXFrameworksBuildPhase; 72 | buildActionMask = 2147483647; 73 | files = ( 74 | ); 75 | runOnlyForDeploymentPostprocessing = 0; 76 | }; 77 | 18BCD0FA1D8B72F400B6E4B5 /* Frameworks */ = { 78 | isa = PBXFrameworksBuildPhase; 79 | buildActionMask = 2147483647; 80 | files = ( 81 | ); 82 | runOnlyForDeploymentPostprocessing = 0; 83 | }; 84 | 18BCD10D1D8B752200B6E4B5 /* Frameworks */ = { 85 | isa = PBXFrameworksBuildPhase; 86 | buildActionMask = 2147483647; 87 | files = ( 88 | ); 89 | runOnlyForDeploymentPostprocessing = 0; 90 | }; 91 | /* End PBXFrameworksBuildPhase section */ 92 | 93 | /* Begin PBXGroup section */ 94 | 1804B6491BCDE57F00BD250F = { 95 | isa = PBXGroup; 96 | children = ( 97 | 182E30D01BD4F44A008EC94E /* SwiftLCS */, 98 | 1804B6691BCDE58000BD250F /* SwiftLCS Tests */, 99 | 1804B6531BCDE57F00BD250F /* Products */, 100 | ); 101 | sourceTree = ""; 102 | }; 103 | 1804B6531BCDE57F00BD250F /* Products */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | 1804B6661BCDE58000BD250F /* SwiftLCS Tests.xctest */, 107 | 182E30CF1BD4F44A008EC94E /* SwiftLCS.framework */, 108 | 18BCD0EE1D8B6FB700B6E4B5 /* SwiftLCS.framework */, 109 | 18BCD0FE1D8B72F400B6E4B5 /* SwiftLCS.framework */, 110 | 18BCD1111D8B752200B6E4B5 /* SwiftLCS.framework */, 111 | ); 112 | name = Products; 113 | sourceTree = ""; 114 | }; 115 | 1804B6691BCDE58000BD250F /* SwiftLCS Tests */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | 1886DD131BCEC60900E67CD7 /* StringTests.swift */, 119 | 1886DD151BCEC7FB00E67CD7 /* ArrayTests.swift */, 120 | 1886DD171BCECA3000E67CD7 /* IndexTests.swift */, 121 | 7D4B06032044EA7600C02F0E /* BenchmarkTests.swift */, 122 | 7D4B06082044F85400C02F0E /* LinkedListTests.swift */, 123 | 1804B66C1BCDE58000BD250F /* Info.plist */, 124 | ); 125 | name = "SwiftLCS Tests"; 126 | path = "Tests/SwiftLCS Tests"; 127 | sourceTree = ""; 128 | }; 129 | 182E30D01BD4F44A008EC94E /* SwiftLCS */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | 182E30DB1BD4F46A008EC94E /* SwiftLCS.swift */, 133 | 18BCD10B1D8B740C00B6E4B5 /* Supporting Files */, 134 | ); 135 | name = SwiftLCS; 136 | path = Source/SwiftLCS; 137 | sourceTree = ""; 138 | }; 139 | 18BCD10B1D8B740C00B6E4B5 /* Supporting Files */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | 182E30D11BD4F44A008EC94E /* SwiftLCS.h */, 143 | 182E30D31BD4F44A008EC94E /* Info.plist */, 144 | 18BCD1061D8B73E000B6E4B5 /* Info-tvOS.plist */, 145 | ); 146 | name = "Supporting Files"; 147 | sourceTree = ""; 148 | }; 149 | /* End PBXGroup section */ 150 | 151 | /* Begin PBXHeadersBuildPhase section */ 152 | 182E30CC1BD4F44A008EC94E /* Headers */ = { 153 | isa = PBXHeadersBuildPhase; 154 | buildActionMask = 2147483647; 155 | files = ( 156 | 182E30D21BD4F44A008EC94E /* SwiftLCS.h in Headers */, 157 | ); 158 | runOnlyForDeploymentPostprocessing = 0; 159 | }; 160 | 18BCD0EB1D8B6FB700B6E4B5 /* Headers */ = { 161 | isa = PBXHeadersBuildPhase; 162 | buildActionMask = 2147483647; 163 | files = ( 164 | 18BCD0F61D8B71BA00B6E4B5 /* SwiftLCS.h in Headers */, 165 | ); 166 | runOnlyForDeploymentPostprocessing = 0; 167 | }; 168 | 18BCD0FB1D8B72F400B6E4B5 /* Headers */ = { 169 | isa = PBXHeadersBuildPhase; 170 | buildActionMask = 2147483647; 171 | files = ( 172 | 18BCD1081D8B73F800B6E4B5 /* SwiftLCS.h in Headers */, 173 | ); 174 | runOnlyForDeploymentPostprocessing = 0; 175 | }; 176 | 18BCD10E1D8B752200B6E4B5 /* Headers */ = { 177 | isa = PBXHeadersBuildPhase; 178 | buildActionMask = 2147483647; 179 | files = ( 180 | 18BCD1191D8B757B00B6E4B5 /* SwiftLCS.h in Headers */, 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | }; 184 | /* End PBXHeadersBuildPhase section */ 185 | 186 | /* Begin PBXNativeTarget section */ 187 | 1804B6651BCDE58000BD250F /* SwiftLCS Tests */ = { 188 | isa = PBXNativeTarget; 189 | buildConfigurationList = 1804B6721BCDE58000BD250F /* Build configuration list for PBXNativeTarget "SwiftLCS Tests" */; 190 | buildPhases = ( 191 | 1804B6621BCDE58000BD250F /* Sources */, 192 | 1804B6631BCDE58000BD250F /* Frameworks */, 193 | 1804B6641BCDE58000BD250F /* Resources */, 194 | ); 195 | buildRules = ( 196 | ); 197 | dependencies = ( 198 | 182E30E01BD4F4FE008EC94E /* PBXTargetDependency */, 199 | ); 200 | name = "SwiftLCS Tests"; 201 | productName = SwiftLCSTests; 202 | productReference = 1804B6661BCDE58000BD250F /* SwiftLCS Tests.xctest */; 203 | productType = "com.apple.product-type.bundle.unit-test"; 204 | }; 205 | 182E30CE1BD4F44A008EC94E /* SwiftLCS iOS */ = { 206 | isa = PBXNativeTarget; 207 | buildConfigurationList = 182E30D81BD4F44A008EC94E /* Build configuration list for PBXNativeTarget "SwiftLCS iOS" */; 208 | buildPhases = ( 209 | 182E30CA1BD4F44A008EC94E /* Sources */, 210 | 182E30CB1BD4F44A008EC94E /* Frameworks */, 211 | 182E30CC1BD4F44A008EC94E /* Headers */, 212 | 182E30CD1BD4F44A008EC94E /* Resources */, 213 | ); 214 | buildRules = ( 215 | ); 216 | dependencies = ( 217 | ); 218 | name = "SwiftLCS iOS"; 219 | productName = SwiftLCS; 220 | productReference = 182E30CF1BD4F44A008EC94E /* SwiftLCS.framework */; 221 | productType = "com.apple.product-type.framework"; 222 | }; 223 | 18BCD0ED1D8B6FB700B6E4B5 /* SwiftLCS watchOS */ = { 224 | isa = PBXNativeTarget; 225 | buildConfigurationList = 18BCD0F31D8B6FB700B6E4B5 /* Build configuration list for PBXNativeTarget "SwiftLCS watchOS" */; 226 | buildPhases = ( 227 | 18BCD0E91D8B6FB700B6E4B5 /* Sources */, 228 | 18BCD0EA1D8B6FB700B6E4B5 /* Frameworks */, 229 | 18BCD0EB1D8B6FB700B6E4B5 /* Headers */, 230 | 18BCD0EC1D8B6FB700B6E4B5 /* Resources */, 231 | ); 232 | buildRules = ( 233 | ); 234 | dependencies = ( 235 | ); 236 | name = "SwiftLCS watchOS"; 237 | productName = "SwiftLCS watchOS"; 238 | productReference = 18BCD0EE1D8B6FB700B6E4B5 /* SwiftLCS.framework */; 239 | productType = "com.apple.product-type.framework"; 240 | }; 241 | 18BCD0FD1D8B72F400B6E4B5 /* SwiftLCS tvOS */ = { 242 | isa = PBXNativeTarget; 243 | buildConfigurationList = 18BCD1031D8B72F400B6E4B5 /* Build configuration list for PBXNativeTarget "SwiftLCS tvOS" */; 244 | buildPhases = ( 245 | 18BCD0F91D8B72F400B6E4B5 /* Sources */, 246 | 18BCD0FA1D8B72F400B6E4B5 /* Frameworks */, 247 | 18BCD0FB1D8B72F400B6E4B5 /* Headers */, 248 | 18BCD0FC1D8B72F400B6E4B5 /* Resources */, 249 | ); 250 | buildRules = ( 251 | ); 252 | dependencies = ( 253 | ); 254 | name = "SwiftLCS tvOS"; 255 | productName = SwiftLCS; 256 | productReference = 18BCD0FE1D8B72F400B6E4B5 /* SwiftLCS.framework */; 257 | productType = "com.apple.product-type.framework"; 258 | }; 259 | 18BCD1101D8B752200B6E4B5 /* SwiftLCS OSX */ = { 260 | isa = PBXNativeTarget; 261 | buildConfigurationList = 18BCD1161D8B752300B6E4B5 /* Build configuration list for PBXNativeTarget "SwiftLCS OSX" */; 262 | buildPhases = ( 263 | 18BCD10C1D8B752200B6E4B5 /* Sources */, 264 | 18BCD10D1D8B752200B6E4B5 /* Frameworks */, 265 | 18BCD10E1D8B752200B6E4B5 /* Headers */, 266 | 18BCD10F1D8B752200B6E4B5 /* Resources */, 267 | ); 268 | buildRules = ( 269 | ); 270 | dependencies = ( 271 | ); 272 | name = "SwiftLCS OSX"; 273 | productName = "SwiftLCS OSX"; 274 | productReference = 18BCD1111D8B752200B6E4B5 /* SwiftLCS.framework */; 275 | productType = "com.apple.product-type.framework"; 276 | }; 277 | /* End PBXNativeTarget section */ 278 | 279 | /* Begin PBXProject section */ 280 | 1804B64A1BCDE57F00BD250F /* Project object */ = { 281 | isa = PBXProject; 282 | attributes = { 283 | LastSwiftUpdateCheck = 0700; 284 | LastUpgradeCheck = 1020; 285 | ORGANIZATIONNAME = "Tommaso Madonia"; 286 | TargetAttributes = { 287 | 1804B6651BCDE58000BD250F = { 288 | CreatedOnToolsVersion = 7.0.1; 289 | LastSwiftMigration = 1020; 290 | }; 291 | 182E30CE1BD4F44A008EC94E = { 292 | CreatedOnToolsVersion = 7.0.1; 293 | LastSwiftMigration = 1020; 294 | ProvisioningStyle = Automatic; 295 | }; 296 | 18BCD0ED1D8B6FB700B6E4B5 = { 297 | CreatedOnToolsVersion = 8.0; 298 | ProvisioningStyle = Automatic; 299 | }; 300 | 18BCD0FD1D8B72F400B6E4B5 = { 301 | CreatedOnToolsVersion = 8.0; 302 | ProvisioningStyle = Automatic; 303 | }; 304 | 18BCD1101D8B752200B6E4B5 = { 305 | CreatedOnToolsVersion = 8.0; 306 | ProvisioningStyle = Automatic; 307 | }; 308 | }; 309 | }; 310 | buildConfigurationList = 1804B64D1BCDE57F00BD250F /* Build configuration list for PBXProject "SwiftLCS" */; 311 | compatibilityVersion = "Xcode 3.2"; 312 | developmentRegion = en; 313 | hasScannedForEncodings = 0; 314 | knownRegions = ( 315 | en, 316 | Base, 317 | ); 318 | mainGroup = 1804B6491BCDE57F00BD250F; 319 | productRefGroup = 1804B6531BCDE57F00BD250F /* Products */; 320 | projectDirPath = ""; 321 | projectRoot = ""; 322 | targets = ( 323 | 1804B6651BCDE58000BD250F /* SwiftLCS Tests */, 324 | 182E30CE1BD4F44A008EC94E /* SwiftLCS iOS */, 325 | 18BCD0ED1D8B6FB700B6E4B5 /* SwiftLCS watchOS */, 326 | 18BCD0FD1D8B72F400B6E4B5 /* SwiftLCS tvOS */, 327 | 18BCD1101D8B752200B6E4B5 /* SwiftLCS OSX */, 328 | ); 329 | }; 330 | /* End PBXProject section */ 331 | 332 | /* Begin PBXResourcesBuildPhase section */ 333 | 1804B6641BCDE58000BD250F /* Resources */ = { 334 | isa = PBXResourcesBuildPhase; 335 | buildActionMask = 2147483647; 336 | files = ( 337 | ); 338 | runOnlyForDeploymentPostprocessing = 0; 339 | }; 340 | 182E30CD1BD4F44A008EC94E /* Resources */ = { 341 | isa = PBXResourcesBuildPhase; 342 | buildActionMask = 2147483647; 343 | files = ( 344 | ); 345 | runOnlyForDeploymentPostprocessing = 0; 346 | }; 347 | 18BCD0EC1D8B6FB700B6E4B5 /* Resources */ = { 348 | isa = PBXResourcesBuildPhase; 349 | buildActionMask = 2147483647; 350 | files = ( 351 | ); 352 | runOnlyForDeploymentPostprocessing = 0; 353 | }; 354 | 18BCD0FC1D8B72F400B6E4B5 /* Resources */ = { 355 | isa = PBXResourcesBuildPhase; 356 | buildActionMask = 2147483647; 357 | files = ( 358 | ); 359 | runOnlyForDeploymentPostprocessing = 0; 360 | }; 361 | 18BCD10F1D8B752200B6E4B5 /* Resources */ = { 362 | isa = PBXResourcesBuildPhase; 363 | buildActionMask = 2147483647; 364 | files = ( 365 | ); 366 | runOnlyForDeploymentPostprocessing = 0; 367 | }; 368 | /* End PBXResourcesBuildPhase section */ 369 | 370 | /* Begin PBXSourcesBuildPhase section */ 371 | 1804B6621BCDE58000BD250F /* Sources */ = { 372 | isa = PBXSourcesBuildPhase; 373 | buildActionMask = 2147483647; 374 | files = ( 375 | 1886DD161BCEC7FB00E67CD7 /* ArrayTests.swift in Sources */, 376 | 7D4B06092044F85400C02F0E /* LinkedListTests.swift in Sources */, 377 | 7D4B06042044EA7600C02F0E /* BenchmarkTests.swift in Sources */, 378 | 1886DD141BCEC60900E67CD7 /* StringTests.swift in Sources */, 379 | 1886DD181BCECA3000E67CD7 /* IndexTests.swift in Sources */, 380 | ); 381 | runOnlyForDeploymentPostprocessing = 0; 382 | }; 383 | 182E30CA1BD4F44A008EC94E /* Sources */ = { 384 | isa = PBXSourcesBuildPhase; 385 | buildActionMask = 2147483647; 386 | files = ( 387 | 182E30DD1BD4F46A008EC94E /* SwiftLCS.swift in Sources */, 388 | ); 389 | runOnlyForDeploymentPostprocessing = 0; 390 | }; 391 | 18BCD0E91D8B6FB700B6E4B5 /* Sources */ = { 392 | isa = PBXSourcesBuildPhase; 393 | buildActionMask = 2147483647; 394 | files = ( 395 | 18BCD0F71D8B71C600B6E4B5 /* SwiftLCS.swift in Sources */, 396 | ); 397 | runOnlyForDeploymentPostprocessing = 0; 398 | }; 399 | 18BCD0F91D8B72F400B6E4B5 /* Sources */ = { 400 | isa = PBXSourcesBuildPhase; 401 | buildActionMask = 2147483647; 402 | files = ( 403 | 18BCD1091D8B740200B6E4B5 /* SwiftLCS.swift in Sources */, 404 | ); 405 | runOnlyForDeploymentPostprocessing = 0; 406 | }; 407 | 18BCD10C1D8B752200B6E4B5 /* Sources */ = { 408 | isa = PBXSourcesBuildPhase; 409 | buildActionMask = 2147483647; 410 | files = ( 411 | 18BCD11A1D8B758200B6E4B5 /* SwiftLCS.swift in Sources */, 412 | ); 413 | runOnlyForDeploymentPostprocessing = 0; 414 | }; 415 | /* End PBXSourcesBuildPhase section */ 416 | 417 | /* Begin PBXTargetDependency section */ 418 | 182E30E01BD4F4FE008EC94E /* PBXTargetDependency */ = { 419 | isa = PBXTargetDependency; 420 | target = 182E30CE1BD4F44A008EC94E /* SwiftLCS iOS */; 421 | targetProxy = 182E30DF1BD4F4FE008EC94E /* PBXContainerItemProxy */; 422 | }; 423 | /* End PBXTargetDependency section */ 424 | 425 | /* Begin XCBuildConfiguration section */ 426 | 1804B66D1BCDE58000BD250F /* Debug */ = { 427 | isa = XCBuildConfiguration; 428 | buildSettings = { 429 | ALWAYS_SEARCH_USER_PATHS = NO; 430 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 431 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 432 | CLANG_CXX_LIBRARY = "libc++"; 433 | CLANG_ENABLE_MODULES = YES; 434 | CLANG_ENABLE_OBJC_ARC = YES; 435 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 436 | CLANG_WARN_BOOL_CONVERSION = YES; 437 | CLANG_WARN_COMMA = YES; 438 | CLANG_WARN_CONSTANT_CONVERSION = YES; 439 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 440 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 441 | CLANG_WARN_EMPTY_BODY = YES; 442 | CLANG_WARN_ENUM_CONVERSION = YES; 443 | CLANG_WARN_INFINITE_RECURSION = YES; 444 | CLANG_WARN_INT_CONVERSION = YES; 445 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 446 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 447 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 448 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 449 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 450 | CLANG_WARN_STRICT_PROTOTYPES = YES; 451 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 452 | CLANG_WARN_UNREACHABLE_CODE = YES; 453 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 454 | CODE_SIGN_IDENTITY = "iPhone Developer"; 455 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 456 | COPY_PHASE_STRIP = NO; 457 | DEBUG_INFORMATION_FORMAT = dwarf; 458 | ENABLE_STRICT_OBJC_MSGSEND = YES; 459 | ENABLE_TESTABILITY = YES; 460 | GCC_C_LANGUAGE_STANDARD = gnu99; 461 | GCC_DYNAMIC_NO_PIC = NO; 462 | GCC_NO_COMMON_BLOCKS = YES; 463 | GCC_OPTIMIZATION_LEVEL = 0; 464 | GCC_PREPROCESSOR_DEFINITIONS = ( 465 | "DEBUG=1", 466 | "$(inherited)", 467 | ); 468 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 469 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 470 | GCC_WARN_UNDECLARED_SELECTOR = YES; 471 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 472 | GCC_WARN_UNUSED_FUNCTION = YES; 473 | GCC_WARN_UNUSED_VARIABLE = YES; 474 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 475 | MACOSX_DEPLOYMENT_TARGET = 10.10; 476 | MTL_ENABLE_DEBUG_INFO = YES; 477 | ONLY_ACTIVE_ARCH = YES; 478 | SDKROOT = iphoneos; 479 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 480 | SWIFT_VERSION = 4.2; 481 | TVOS_DEPLOYMENT_TARGET = 9.0; 482 | WATCHOS_DEPLOYMENT_TARGET = 2.0; 483 | }; 484 | name = Debug; 485 | }; 486 | 1804B66E1BCDE58000BD250F /* Release */ = { 487 | isa = XCBuildConfiguration; 488 | buildSettings = { 489 | ALWAYS_SEARCH_USER_PATHS = NO; 490 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 491 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 492 | CLANG_CXX_LIBRARY = "libc++"; 493 | CLANG_ENABLE_MODULES = YES; 494 | CLANG_ENABLE_OBJC_ARC = YES; 495 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 496 | CLANG_WARN_BOOL_CONVERSION = YES; 497 | CLANG_WARN_COMMA = YES; 498 | CLANG_WARN_CONSTANT_CONVERSION = YES; 499 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 500 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 501 | CLANG_WARN_EMPTY_BODY = YES; 502 | CLANG_WARN_ENUM_CONVERSION = YES; 503 | CLANG_WARN_INFINITE_RECURSION = YES; 504 | CLANG_WARN_INT_CONVERSION = YES; 505 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 506 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 507 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 508 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 509 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 510 | CLANG_WARN_STRICT_PROTOTYPES = YES; 511 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 512 | CLANG_WARN_UNREACHABLE_CODE = YES; 513 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 514 | CODE_SIGN_IDENTITY = "iPhone Developer"; 515 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 516 | COPY_PHASE_STRIP = NO; 517 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 518 | ENABLE_NS_ASSERTIONS = NO; 519 | ENABLE_STRICT_OBJC_MSGSEND = YES; 520 | GCC_C_LANGUAGE_STANDARD = gnu99; 521 | GCC_NO_COMMON_BLOCKS = YES; 522 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 523 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 524 | GCC_WARN_UNDECLARED_SELECTOR = YES; 525 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 526 | GCC_WARN_UNUSED_FUNCTION = YES; 527 | GCC_WARN_UNUSED_VARIABLE = YES; 528 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 529 | MACOSX_DEPLOYMENT_TARGET = 10.10; 530 | MTL_ENABLE_DEBUG_INFO = NO; 531 | SDKROOT = iphoneos; 532 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 533 | SWIFT_VERSION = 4.2; 534 | TVOS_DEPLOYMENT_TARGET = 9.0; 535 | VALIDATE_PRODUCT = YES; 536 | WATCHOS_DEPLOYMENT_TARGET = 2.0; 537 | }; 538 | name = Release; 539 | }; 540 | 1804B6731BCDE58000BD250F /* Debug */ = { 541 | isa = XCBuildConfiguration; 542 | buildSettings = { 543 | INFOPLIST_FILE = "Tests/SwiftLCS Tests/Info.plist"; 544 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 545 | PRODUCT_BUNDLE_IDENTIFIER = com.tommasomadonia.SwiftLCSTests; 546 | PRODUCT_NAME = "$(TARGET_NAME)"; 547 | SWIFT_VERSION = 5.0; 548 | }; 549 | name = Debug; 550 | }; 551 | 1804B6741BCDE58000BD250F /* Release */ = { 552 | isa = XCBuildConfiguration; 553 | buildSettings = { 554 | INFOPLIST_FILE = "Tests/SwiftLCS Tests/Info.plist"; 555 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 556 | PRODUCT_BUNDLE_IDENTIFIER = com.tommasomadonia.SwiftLCSTests; 557 | PRODUCT_NAME = "$(TARGET_NAME)"; 558 | SWIFT_VERSION = 5.0; 559 | }; 560 | name = Release; 561 | }; 562 | 182E30D91BD4F44A008EC94E /* Debug */ = { 563 | isa = XCBuildConfiguration; 564 | buildSettings = { 565 | APPLICATION_EXTENSION_API_ONLY = YES; 566 | CLANG_ENABLE_MODULES = YES; 567 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 568 | CURRENT_PROJECT_VERSION = 1; 569 | DEFINES_MODULE = YES; 570 | DYLIB_COMPATIBILITY_VERSION = 1; 571 | DYLIB_CURRENT_VERSION = 1; 572 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 573 | INFOPLIST_FILE = Source/SwiftLCS/Info.plist; 574 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 575 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 576 | PRODUCT_BUNDLE_IDENTIFIER = com.tommasomadonia.SwiftLCS; 577 | PRODUCT_NAME = SwiftLCS; 578 | SKIP_INSTALL = YES; 579 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 580 | SWIFT_VERSION = 5.0; 581 | TARGETED_DEVICE_FAMILY = "1,2"; 582 | VERSIONING_SYSTEM = "apple-generic"; 583 | VERSION_INFO_PREFIX = ""; 584 | }; 585 | name = Debug; 586 | }; 587 | 182E30DA1BD4F44A008EC94E /* Release */ = { 588 | isa = XCBuildConfiguration; 589 | buildSettings = { 590 | APPLICATION_EXTENSION_API_ONLY = YES; 591 | CLANG_ENABLE_MODULES = YES; 592 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 593 | CURRENT_PROJECT_VERSION = 1; 594 | DEFINES_MODULE = YES; 595 | DYLIB_COMPATIBILITY_VERSION = 1; 596 | DYLIB_CURRENT_VERSION = 1; 597 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 598 | INFOPLIST_FILE = Source/SwiftLCS/Info.plist; 599 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 600 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 601 | PRODUCT_BUNDLE_IDENTIFIER = com.tommasomadonia.SwiftLCS; 602 | PRODUCT_NAME = SwiftLCS; 603 | SKIP_INSTALL = YES; 604 | SWIFT_VERSION = 5.0; 605 | TARGETED_DEVICE_FAMILY = "1,2"; 606 | VERSIONING_SYSTEM = "apple-generic"; 607 | VERSION_INFO_PREFIX = ""; 608 | }; 609 | name = Release; 610 | }; 611 | 18BCD0F41D8B6FB700B6E4B5 /* Debug */ = { 612 | isa = XCBuildConfiguration; 613 | buildSettings = { 614 | APPLICATION_EXTENSION_API_ONLY = YES; 615 | CLANG_ANALYZER_NONNULL = YES; 616 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 617 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 618 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; 619 | CURRENT_PROJECT_VERSION = 1; 620 | DEFINES_MODULE = YES; 621 | DYLIB_COMPATIBILITY_VERSION = 1; 622 | DYLIB_CURRENT_VERSION = 1; 623 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 624 | INFOPLIST_FILE = Source/SwiftLCS/Info.plist; 625 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 626 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 627 | PRODUCT_BUNDLE_IDENTIFIER = com.tommasomadonia.SwiftLCS; 628 | PRODUCT_NAME = SwiftLCS; 629 | SDKROOT = watchos; 630 | SKIP_INSTALL = YES; 631 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 632 | TARGETED_DEVICE_FAMILY = 4; 633 | VERSIONING_SYSTEM = "apple-generic"; 634 | VERSION_INFO_PREFIX = ""; 635 | }; 636 | name = Debug; 637 | }; 638 | 18BCD0F51D8B6FB700B6E4B5 /* Release */ = { 639 | isa = XCBuildConfiguration; 640 | buildSettings = { 641 | APPLICATION_EXTENSION_API_ONLY = YES; 642 | CLANG_ANALYZER_NONNULL = YES; 643 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 644 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 645 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; 646 | CURRENT_PROJECT_VERSION = 1; 647 | DEFINES_MODULE = YES; 648 | DYLIB_COMPATIBILITY_VERSION = 1; 649 | DYLIB_CURRENT_VERSION = 1; 650 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 651 | INFOPLIST_FILE = Source/SwiftLCS/Info.plist; 652 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 653 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 654 | PRODUCT_BUNDLE_IDENTIFIER = com.tommasomadonia.SwiftLCS; 655 | PRODUCT_NAME = SwiftLCS; 656 | SDKROOT = watchos; 657 | SKIP_INSTALL = YES; 658 | TARGETED_DEVICE_FAMILY = 4; 659 | VERSIONING_SYSTEM = "apple-generic"; 660 | VERSION_INFO_PREFIX = ""; 661 | }; 662 | name = Release; 663 | }; 664 | 18BCD1041D8B72F400B6E4B5 /* Debug */ = { 665 | isa = XCBuildConfiguration; 666 | buildSettings = { 667 | APPLICATION_EXTENSION_API_ONLY = YES; 668 | CLANG_ANALYZER_NONNULL = YES; 669 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 670 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 671 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; 672 | CURRENT_PROJECT_VERSION = 1; 673 | DEFINES_MODULE = YES; 674 | DYLIB_COMPATIBILITY_VERSION = 1; 675 | DYLIB_CURRENT_VERSION = 1; 676 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 677 | INFOPLIST_FILE = "Source/SwiftLCS/Info-tvOS.plist"; 678 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 679 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 680 | PRODUCT_BUNDLE_IDENTIFIER = com.tommasomadonia.SwiftLCS; 681 | PRODUCT_NAME = SwiftLCS; 682 | SDKROOT = appletvos; 683 | SKIP_INSTALL = YES; 684 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 685 | TARGETED_DEVICE_FAMILY = 3; 686 | VERSIONING_SYSTEM = "apple-generic"; 687 | VERSION_INFO_PREFIX = ""; 688 | }; 689 | name = Debug; 690 | }; 691 | 18BCD1051D8B72F400B6E4B5 /* Release */ = { 692 | isa = XCBuildConfiguration; 693 | buildSettings = { 694 | APPLICATION_EXTENSION_API_ONLY = YES; 695 | CLANG_ANALYZER_NONNULL = YES; 696 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 697 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 698 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; 699 | CURRENT_PROJECT_VERSION = 1; 700 | DEFINES_MODULE = YES; 701 | DYLIB_COMPATIBILITY_VERSION = 1; 702 | DYLIB_CURRENT_VERSION = 1; 703 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 704 | INFOPLIST_FILE = "Source/SwiftLCS/Info-tvOS.plist"; 705 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 706 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 707 | PRODUCT_BUNDLE_IDENTIFIER = com.tommasomadonia.SwiftLCS; 708 | PRODUCT_NAME = SwiftLCS; 709 | SDKROOT = appletvos; 710 | SKIP_INSTALL = YES; 711 | TARGETED_DEVICE_FAMILY = 3; 712 | VERSIONING_SYSTEM = "apple-generic"; 713 | VERSION_INFO_PREFIX = ""; 714 | }; 715 | name = Release; 716 | }; 717 | 18BCD1171D8B752300B6E4B5 /* Debug */ = { 718 | isa = XCBuildConfiguration; 719 | buildSettings = { 720 | APPLICATION_EXTENSION_API_ONLY = YES; 721 | CLANG_ANALYZER_NONNULL = YES; 722 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 723 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 724 | CODE_SIGN_IDENTITY = ""; 725 | COMBINE_HIDPI_IMAGES = YES; 726 | CURRENT_PROJECT_VERSION = 1; 727 | DEFINES_MODULE = YES; 728 | DYLIB_COMPATIBILITY_VERSION = 1; 729 | DYLIB_CURRENT_VERSION = 1; 730 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 731 | FRAMEWORK_VERSION = A; 732 | INFOPLIST_FILE = Source/SwiftLCS/Info.plist; 733 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 734 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; 735 | PRODUCT_BUNDLE_IDENTIFIER = com.tommasomadonia.SwiftLCS; 736 | PRODUCT_NAME = SwiftLCS; 737 | SDKROOT = macosx; 738 | SKIP_INSTALL = YES; 739 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 740 | VERSIONING_SYSTEM = "apple-generic"; 741 | VERSION_INFO_PREFIX = ""; 742 | }; 743 | name = Debug; 744 | }; 745 | 18BCD1181D8B752300B6E4B5 /* Release */ = { 746 | isa = XCBuildConfiguration; 747 | buildSettings = { 748 | APPLICATION_EXTENSION_API_ONLY = YES; 749 | CLANG_ANALYZER_NONNULL = YES; 750 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 751 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 752 | CODE_SIGN_IDENTITY = ""; 753 | COMBINE_HIDPI_IMAGES = YES; 754 | CURRENT_PROJECT_VERSION = 1; 755 | DEFINES_MODULE = YES; 756 | DYLIB_COMPATIBILITY_VERSION = 1; 757 | DYLIB_CURRENT_VERSION = 1; 758 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 759 | FRAMEWORK_VERSION = A; 760 | INFOPLIST_FILE = Source/SwiftLCS/Info.plist; 761 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 762 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; 763 | PRODUCT_BUNDLE_IDENTIFIER = com.tommasomadonia.SwiftLCS; 764 | PRODUCT_NAME = SwiftLCS; 765 | SDKROOT = macosx; 766 | SKIP_INSTALL = YES; 767 | VERSIONING_SYSTEM = "apple-generic"; 768 | VERSION_INFO_PREFIX = ""; 769 | }; 770 | name = Release; 771 | }; 772 | /* End XCBuildConfiguration section */ 773 | 774 | /* Begin XCConfigurationList section */ 775 | 1804B64D1BCDE57F00BD250F /* Build configuration list for PBXProject "SwiftLCS" */ = { 776 | isa = XCConfigurationList; 777 | buildConfigurations = ( 778 | 1804B66D1BCDE58000BD250F /* Debug */, 779 | 1804B66E1BCDE58000BD250F /* Release */, 780 | ); 781 | defaultConfigurationIsVisible = 0; 782 | defaultConfigurationName = Release; 783 | }; 784 | 1804B6721BCDE58000BD250F /* Build configuration list for PBXNativeTarget "SwiftLCS Tests" */ = { 785 | isa = XCConfigurationList; 786 | buildConfigurations = ( 787 | 1804B6731BCDE58000BD250F /* Debug */, 788 | 1804B6741BCDE58000BD250F /* Release */, 789 | ); 790 | defaultConfigurationIsVisible = 0; 791 | defaultConfigurationName = Release; 792 | }; 793 | 182E30D81BD4F44A008EC94E /* Build configuration list for PBXNativeTarget "SwiftLCS iOS" */ = { 794 | isa = XCConfigurationList; 795 | buildConfigurations = ( 796 | 182E30D91BD4F44A008EC94E /* Debug */, 797 | 182E30DA1BD4F44A008EC94E /* Release */, 798 | ); 799 | defaultConfigurationIsVisible = 0; 800 | defaultConfigurationName = Release; 801 | }; 802 | 18BCD0F31D8B6FB700B6E4B5 /* Build configuration list for PBXNativeTarget "SwiftLCS watchOS" */ = { 803 | isa = XCConfigurationList; 804 | buildConfigurations = ( 805 | 18BCD0F41D8B6FB700B6E4B5 /* Debug */, 806 | 18BCD0F51D8B6FB700B6E4B5 /* Release */, 807 | ); 808 | defaultConfigurationIsVisible = 0; 809 | defaultConfigurationName = Release; 810 | }; 811 | 18BCD1031D8B72F400B6E4B5 /* Build configuration list for PBXNativeTarget "SwiftLCS tvOS" */ = { 812 | isa = XCConfigurationList; 813 | buildConfigurations = ( 814 | 18BCD1041D8B72F400B6E4B5 /* Debug */, 815 | 18BCD1051D8B72F400B6E4B5 /* Release */, 816 | ); 817 | defaultConfigurationIsVisible = 0; 818 | defaultConfigurationName = Release; 819 | }; 820 | 18BCD1161D8B752300B6E4B5 /* Build configuration list for PBXNativeTarget "SwiftLCS OSX" */ = { 821 | isa = XCConfigurationList; 822 | buildConfigurations = ( 823 | 18BCD1171D8B752300B6E4B5 /* Debug */, 824 | 18BCD1181D8B752300B6E4B5 /* Release */, 825 | ); 826 | defaultConfigurationIsVisible = 0; 827 | defaultConfigurationName = Release; 828 | }; 829 | /* End XCConfigurationList section */ 830 | }; 831 | rootObject = 1804B64A1BCDE57F00BD250F /* Project object */; 832 | } 833 | -------------------------------------------------------------------------------- /SwiftLCS.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SwiftLCS.xcodeproj/xcshareddata/xcschemes/SwiftLCS OSX.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /SwiftLCS.xcodeproj/xcshareddata/xcschemes/SwiftLCS iOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 45 | 46 | 48 | 54 | 55 | 56 | 57 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 79 | 80 | 86 | 87 | 88 | 89 | 90 | 91 | 97 | 98 | 104 | 105 | 106 | 107 | 109 | 110 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /SwiftLCS.xcodeproj/xcshareddata/xcschemes/SwiftLCS tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /SwiftLCS.xcodeproj/xcshareddata/xcschemes/SwiftLCS watchOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 55 | 61 | 62 | 63 | 64 | 65 | 66 | 72 | 73 | 79 | 80 | 81 | 82 | 84 | 85 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /SwiftLCS.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /SwiftLCS.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Tests/LinuxMain.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | import SwiftLCS_Tests 4 | 5 | var tests = [XCTestCaseEntry]() 6 | tests += SwiftLCS_Tests.__allTests() 7 | 8 | XCTMain(tests) 9 | -------------------------------------------------------------------------------- /Tests/SwiftLCS Tests/ArrayTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // The MIT License (MIT) 3 | // 4 | // Copyright (c) 2015 Tommaso Madonia 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | 25 | import XCTest 26 | @testable import SwiftLCS 27 | 28 | class ArrayTests: XCTestCase { 29 | 30 | override func setUp() { 31 | super.setUp() 32 | // Put setup code here. This method is called before the invocation of each test method in the class. 33 | } 34 | 35 | override func tearDown() { 36 | // Put teardown code here. This method is called after the invocation of each test method in the class. 37 | super.tearDown() 38 | } 39 | 40 | func testSimple() { 41 | let old = [1, 2, 3, 4, 5, 6, 7] 42 | let new = [8, 9, 2, 10, 4, 11, 6, 12] 43 | XCTAssertEqual(old.longestCommonSubsequence(new), [2, 4, 6]) 44 | } 45 | 46 | func testPrefix() { 47 | let old = [1, 2, 3, 4, 5] 48 | let new = [1, 2, 3, 6, 7] 49 | XCTAssertEqual(old.longestCommonSubsequence(new), [1, 2, 3]) 50 | } 51 | 52 | func testSuffix() { 53 | let old = [1, 2, 3, 4, 5] 54 | let new = [6, 7, 3, 4, 5] 55 | XCTAssertEqual(old.longestCommonSubsequence(new), [3, 4, 5]) 56 | } 57 | 58 | func testContains() { 59 | let old = [1, 2, 3, 4, 5] 60 | let new = [6, 7, 1, 2, 3, 4, 5] 61 | XCTAssertEqual(old.longestCommonSubsequence(new), [1, 2, 3, 4, 5]) 62 | } 63 | 64 | func testEqual() { 65 | let old = [1, 2, 3, 4, 5] 66 | let new = [1, 2, 3, 4, 5] 67 | XCTAssertEqual(old.longestCommonSubsequence(new), [1, 2, 3, 4, 5]) 68 | } 69 | 70 | func testEmpty() { 71 | let old = [1, 2, 3, 4, 5] 72 | let new = [Int]() 73 | XCTAssertEqual(old.longestCommonSubsequence(new), [Int]()) 74 | XCTAssertEqual(new.longestCommonSubsequence(old), [Int]()) 75 | } 76 | 77 | func testBothEmpty() { 78 | let old = [Int]() 79 | let new = [Int]() 80 | XCTAssertEqual(old.longestCommonSubsequence(new), [Int]()) 81 | XCTAssertEqual(new.longestCommonSubsequence(old), [Int]()) 82 | } 83 | 84 | func testBothSingle() { 85 | let old = [1] 86 | let new = [1] 87 | XCTAssertEqual(old.longestCommonSubsequence(new), [1]) 88 | XCTAssertEqual(new.longestCommonSubsequence(old), [1]) 89 | } 90 | 91 | func testDifferentLengths() { 92 | let old = [1, 2, 3, 4, 5, 6] 93 | let new = [1, 6, 7, 2, 3] 94 | XCTAssertEqual(old.longestCommonSubsequence(new), [1, 2, 3]) 95 | XCTAssertEqual(new.longestCommonSubsequence(old), [1, 2, 3]) 96 | } 97 | 98 | func testAppend() { 99 | let old = [1, 2, 3, 4, 5, 6, 7] 100 | let new = old + [8, 9, 10, 11] 101 | XCTAssertEqual(old.longestCommonSubsequence(new), [1, 2, 3, 4, 5, 6, 7]) 102 | } 103 | 104 | func testPrependAndAppend() { 105 | let old = [1, 2, 3, 4, 5, 6, 7] 106 | let new = [0] + old + [8, 9, 10, 11] 107 | XCTAssertEqual(old.longestCommonSubsequence(new), [1, 2, 3, 4, 5, 6, 7]) 108 | } 109 | 110 | } 111 | -------------------------------------------------------------------------------- /Tests/SwiftLCS Tests/BenchmarkTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // The MIT License (MIT) 3 | // 4 | // Copyright (c) 2018 Tommaso Madonia 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | 25 | import XCTest 26 | @testable import SwiftLCS 27 | 28 | class BenchmarkTests: XCTestCase { 29 | 30 | override func setUp() { 31 | super.setUp() 32 | // Put setup code here. This method is called before the invocation of each test method in the class. 33 | } 34 | 35 | override func tearDown() { 36 | // Put teardown code here. This method is called after the invocation of each test method in the class. 37 | super.tearDown() 38 | } 39 | 40 | func testBenchmark100() { 41 | let old: [Int] = (0...100).map({ _ in Int(arc4random_uniform(10)) }) 42 | let new: [Int] = (0...100).map({ _ in Int(arc4random_uniform(10)) }) 43 | measure { 44 | let _ = old.longestCommonSubsequence(new) 45 | } 46 | } 47 | 48 | func testBenchmark1000() { 49 | let old: [Int] = (0...1000).map({ _ in Int(arc4random_uniform(100)) }) 50 | let new: [Int] = (0...1000).map({ _ in Int(arc4random_uniform(100)) }) 51 | measure { 52 | let _ = old.longestCommonSubsequence(new) 53 | } 54 | } 55 | 56 | func testBenchmark2000() { 57 | let old: [Int] = (0...2000).map({ _ in Int(arc4random_uniform(1000)) }) 58 | let new: [Int] = (0...2000).map({ _ in Int(arc4random_uniform(1000)) }) 59 | measure { 60 | let _ = old.longestCommonSubsequence(new) 61 | } 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /Tests/SwiftLCS Tests/IndexTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // The MIT License (MIT) 3 | // 4 | // Copyright (c) 2015 Tommaso Madonia 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | 25 | import XCTest 26 | @testable import SwiftLCS 27 | 28 | class IndexTests: XCTestCase { 29 | 30 | override func setUp() { 31 | super.setUp() 32 | // Put setup code here. This method is called before the invocation of each test method in the class. 33 | } 34 | 35 | override func tearDown() { 36 | // Put teardown code here. This method is called after the invocation of each test method in the class. 37 | super.tearDown() 38 | } 39 | 40 | func testSimple() { 41 | let old = [1, 2, 3, 4, 5, 6, 7] 42 | let new = [8, 9, 2, 10, 4, 11, 6, 12] 43 | let diff = Diff(old, new) 44 | 45 | XCTAssertEqual(diff.commonIndexes, [1, 3, 5]) 46 | XCTAssertEqual(diff.addedIndexes, [0, 1, 3, 5, 7]) 47 | XCTAssertEqual(diff.removedIndexes, [0, 2, 4, 6]) 48 | 49 | XCTAssertEqual(diff.commonIndexes.count + diff.removedIndexes.count, old.count) 50 | XCTAssertEqual(diff.commonIndexes.count + diff.addedIndexes.count, new.count) 51 | } 52 | 53 | func testPrefix() { 54 | let old = [1, 2, 3, 4, 5] 55 | let new = [1, 2, 3, 6, 7] 56 | let diff = Diff(old, new) 57 | 58 | XCTAssertEqual(diff.commonIndexes, [0, 1, 2]) 59 | XCTAssertEqual(diff.addedIndexes, [3, 4]) 60 | XCTAssertEqual(diff.removedIndexes, [3, 4]) 61 | 62 | XCTAssertEqual(diff.commonIndexes.count + diff.removedIndexes.count, old.count) 63 | XCTAssertEqual(diff.commonIndexes.count + diff.addedIndexes.count, new.count) 64 | } 65 | 66 | func testSuffix() { 67 | let old = [1, 2, 3, 4, 5] 68 | let new = [6, 7, 3, 4, 5] 69 | let diff = Diff(old, new) 70 | 71 | XCTAssertEqual(diff.commonIndexes, [2, 3, 4]) 72 | XCTAssertEqual(diff.addedIndexes, [0, 1]) 73 | XCTAssertEqual(diff.removedIndexes, [0, 1]) 74 | 75 | XCTAssertEqual(diff.commonIndexes.count + diff.removedIndexes.count, old.count) 76 | XCTAssertEqual(diff.commonIndexes.count + diff.addedIndexes.count, new.count) 77 | } 78 | 79 | func testContains() { 80 | let old = [1, 2, 3, 4, 5] 81 | let new = [6, 7, 1, 2, 3, 4, 5] 82 | let diff = Diff(old, new) 83 | 84 | XCTAssertEqual(diff.commonIndexes, [0, 1, 2, 3, 4]) 85 | XCTAssertEqual(diff.addedIndexes, [0, 1]) 86 | XCTAssertEqual(diff.removedIndexes, []) 87 | 88 | XCTAssertEqual(diff.commonIndexes.count + diff.removedIndexes.count, old.count) 89 | XCTAssertEqual(diff.commonIndexes.count + diff.addedIndexes.count, new.count) 90 | } 91 | 92 | func testEqual() { 93 | let old = [1, 2, 3, 4, 5] 94 | let new = [1, 2, 3, 4, 5] 95 | let diff = Diff(old, new) 96 | 97 | XCTAssertEqual(diff.commonIndexes, [0, 1, 2, 3, 4]) 98 | XCTAssertEqual(diff.addedIndexes, []) 99 | XCTAssertEqual(diff.removedIndexes, []) 100 | 101 | XCTAssertEqual(diff.commonIndexes.count + diff.removedIndexes.count, old.count) 102 | XCTAssertEqual(diff.commonIndexes.count + diff.addedIndexes.count, new.count) 103 | } 104 | 105 | func testEmpty() { 106 | let old = [1, 2, 3, 4, 5] 107 | let new = [Int]() 108 | let diff = Diff(old, new) 109 | 110 | XCTAssertEqual(diff.commonIndexes, []) 111 | XCTAssertEqual(diff.addedIndexes, []) 112 | XCTAssertEqual(diff.removedIndexes, [0, 1, 2, 3, 4]) 113 | 114 | XCTAssertEqual(diff.commonIndexes.count + diff.removedIndexes.count, old.count) 115 | XCTAssertEqual(diff.commonIndexes.count + diff.addedIndexes.count, new.count) 116 | } 117 | 118 | func testBothEmpty() { 119 | let old = [Int]() 120 | let new = [Int]() 121 | let diff = Diff(old, new) 122 | 123 | XCTAssertEqual(diff.commonIndexes, []) 124 | XCTAssertEqual(diff.addedIndexes, []) 125 | XCTAssertEqual(diff.removedIndexes, []) 126 | 127 | XCTAssertEqual(diff.commonIndexes.count + diff.removedIndexes.count, old.count) 128 | XCTAssertEqual(diff.commonIndexes.count + diff.addedIndexes.count, new.count) 129 | } 130 | 131 | func testDifferentLengths() { 132 | let old = [1, 2, 3, 4, 5, 6] 133 | let new = [1, 6, 7, 2, 3] 134 | let diff = Diff(old, new) 135 | 136 | XCTAssertEqual(diff.commonIndexes, [0, 1, 2]) 137 | XCTAssertEqual(diff.addedIndexes, [1, 2]) 138 | XCTAssertEqual(diff.removedIndexes, [3, 4, 5]) 139 | 140 | XCTAssertEqual(diff.commonIndexes.count + diff.removedIndexes.count, old.count) 141 | XCTAssertEqual(diff.commonIndexes.count + diff.addedIndexes.count, new.count) 142 | } 143 | 144 | func testAddMultipleCopiesStart() { 145 | let old = [0, 1, 2] 146 | let new = [3, 3, 0, 1, 2] 147 | let diff = Diff(old, new) 148 | 149 | XCTAssertEqual(diff.commonIndexes, [0, 1, 2]) 150 | XCTAssertEqual(diff.addedIndexes, [0, 1]) 151 | XCTAssertEqual(diff.removedIndexes, []) 152 | 153 | XCTAssertEqual(diff.commonIndexes.count + diff.removedIndexes.count, old.count) 154 | XCTAssertEqual(diff.commonIndexes.count + diff.addedIndexes.count, new.count) 155 | } 156 | 157 | func testAddMultipleCopies() { 158 | let old = [0, 1, 2] 159 | let new = [3, 0, 3, 2, 3] 160 | let diff = Diff(old, new) 161 | 162 | XCTAssertEqual(diff.commonIndexes, [0, 2]) 163 | XCTAssertEqual(diff.addedIndexes, [0, 2, 4]) 164 | XCTAssertEqual(diff.removedIndexes, [1]) 165 | 166 | XCTAssertEqual(diff.commonIndexes.count + diff.removedIndexes.count, old.count) 167 | XCTAssertEqual(diff.commonIndexes.count + diff.addedIndexes.count, new.count) 168 | } 169 | 170 | func testAddMultipleCopiesEnd() { 171 | let old = [0, 1, 2] 172 | let new = [0, 1, 2, 3, 3] 173 | let diff = Diff(old, new) 174 | 175 | XCTAssertEqual(diff.commonIndexes, [0, 1, 2]) 176 | XCTAssertEqual(diff.addedIndexes, [3, 4]) 177 | XCTAssertEqual(diff.removedIndexes, []) 178 | 179 | XCTAssertEqual(diff.commonIndexes.count + diff.removedIndexes.count, old.count) 180 | XCTAssertEqual(diff.commonIndexes.count + diff.addedIndexes.count, new.count) 181 | } 182 | 183 | func testNSIndexSet() { 184 | let old = [1, 2, 3, 4, 5, 6, 7] 185 | let new = [8, 9, 2, 10, 4, 11, 6, 12] 186 | let diff = Diff(old, new) 187 | 188 | let commonIndexSet = IndexSet([1, 3, 5]) 189 | XCTAssertEqual(diff.commonIndexSet, commonIndexSet) 190 | 191 | let addedIndexSet = IndexSet([0, 1, 3, 5, 7]) 192 | XCTAssertEqual(diff.addedIndexSet, addedIndexSet) 193 | 194 | let removedIndexSet = IndexSet([0, 2, 4, 6]) 195 | XCTAssertEqual(diff.removedIndexSet, removedIndexSet) 196 | } 197 | 198 | } 199 | -------------------------------------------------------------------------------- /Tests/SwiftLCS Tests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Tests/SwiftLCS Tests/LinkedListTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // The MIT License (MIT) 3 | // 4 | // Copyright (c) 2018 Tommaso Madonia 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | 25 | import XCTest 26 | @testable import SwiftLCS 27 | 28 | class LinkedListTests: XCTestCase { 29 | 30 | override func setUp() { 31 | super.setUp() 32 | // Put setup code here. This method is called before the invocation of each test method in the class. 33 | } 34 | 35 | override func tearDown() { 36 | // Put teardown code here. This method is called after the invocation of each test method in the class. 37 | super.tearDown() 38 | } 39 | 40 | func testSimple() { 41 | let old: LinkedList = [1, 2, 3, 4, 5, 6, 7] 42 | let new: LinkedList = [8, 9, 2, 10, 4, 11, 6, 12] 43 | let diff = Diff(old, new) 44 | 45 | XCTAssertEqual(diff.commonIndexes, [1, 3, 5]) 46 | XCTAssertEqual(diff.addedIndexes, [0, 1, 3, 5, 7]) 47 | XCTAssertEqual(diff.removedIndexes, [0, 2, 4, 6]) 48 | 49 | XCTAssertEqual(diff.commonIndexes.count + diff.removedIndexes.count, old.count) 50 | XCTAssertEqual(diff.commonIndexes.count + diff.addedIndexes.count, new.count) 51 | } 52 | 53 | func testPrefix() { 54 | let old: LinkedList = [1, 2, 3, 4, 5] 55 | let new: LinkedList = [1, 2, 3, 6, 7] 56 | let diff = Diff(old, new) 57 | 58 | XCTAssertEqual(diff.commonIndexes, [0, 1, 2]) 59 | XCTAssertEqual(diff.addedIndexes, [3, 4]) 60 | XCTAssertEqual(diff.removedIndexes, [3, 4]) 61 | 62 | XCTAssertEqual(diff.commonIndexes.count + diff.removedIndexes.count, old.count) 63 | XCTAssertEqual(diff.commonIndexes.count + diff.addedIndexes.count, new.count) 64 | } 65 | 66 | func testSuffix() { 67 | let old: LinkedList = [1, 2, 3, 4, 5] 68 | let new: LinkedList = [6, 7, 3, 4, 5] 69 | let diff = Diff(old, new) 70 | 71 | XCTAssertEqual(diff.commonIndexes, [2, 3, 4]) 72 | XCTAssertEqual(diff.addedIndexes, [0, 1]) 73 | XCTAssertEqual(diff.removedIndexes, [0, 1]) 74 | 75 | XCTAssertEqual(diff.commonIndexes.count + diff.removedIndexes.count, old.count) 76 | XCTAssertEqual(diff.commonIndexes.count + diff.addedIndexes.count, new.count) 77 | } 78 | 79 | func testContains() { 80 | let old: LinkedList = [1, 2, 3, 4, 5] 81 | let new: LinkedList = [6, 7, 1, 2, 3, 4, 5] 82 | let diff = Diff(old, new) 83 | 84 | XCTAssertEqual(diff.commonIndexes, [0, 1, 2, 3, 4]) 85 | XCTAssertEqual(diff.addedIndexes, [0, 1]) 86 | XCTAssertEqual(diff.removedIndexes, []) 87 | 88 | XCTAssertEqual(diff.commonIndexes.count + diff.removedIndexes.count, old.count) 89 | XCTAssertEqual(diff.commonIndexes.count + diff.addedIndexes.count, new.count) 90 | } 91 | 92 | func testEqual() { 93 | let old: LinkedList = [1, 2, 3, 4, 5] 94 | let new: LinkedList = [1, 2, 3, 4, 5] 95 | let diff = Diff(old, new) 96 | 97 | XCTAssertEqual(diff.commonIndexes, [0, 1, 2, 3, 4]) 98 | XCTAssertEqual(diff.addedIndexes, []) 99 | XCTAssertEqual(diff.removedIndexes, []) 100 | 101 | XCTAssertEqual(diff.commonIndexes.count + diff.removedIndexes.count, old.count) 102 | XCTAssertEqual(diff.commonIndexes.count + diff.addedIndexes.count, new.count) 103 | } 104 | 105 | func testEmpty() { 106 | let old: LinkedList = [1, 2, 3, 4, 5] 107 | let new: LinkedList = [] 108 | let diff = Diff(old, new) 109 | 110 | XCTAssertEqual(diff.commonIndexes, []) 111 | XCTAssertEqual(diff.addedIndexes, []) 112 | XCTAssertEqual(diff.removedIndexes, [0, 1, 2, 3, 4]) 113 | 114 | XCTAssertEqual(diff.commonIndexes.count + diff.removedIndexes.count, old.count) 115 | XCTAssertEqual(diff.commonIndexes.count + diff.addedIndexes.count, new.count) 116 | } 117 | 118 | func testBothEmpty() { 119 | let old: LinkedList = [] 120 | let new: LinkedList = [] 121 | let diff = Diff(old, new) 122 | 123 | XCTAssertEqual(diff.commonIndexes, []) 124 | XCTAssertEqual(diff.addedIndexes, []) 125 | XCTAssertEqual(diff.removedIndexes, []) 126 | 127 | XCTAssertEqual(diff.commonIndexes.count + diff.removedIndexes.count, old.count) 128 | XCTAssertEqual(diff.commonIndexes.count + diff.addedIndexes.count, new.count) 129 | } 130 | 131 | func testDifferentLengths() { 132 | let old: LinkedList = [1, 2, 3, 4, 5, 6] 133 | let new: LinkedList = [1, 6, 7, 2, 3] 134 | let diff = Diff(old, new) 135 | 136 | XCTAssertEqual(diff.commonIndexes, [0, 1, 2]) 137 | XCTAssertEqual(diff.addedIndexes, [1, 2]) 138 | XCTAssertEqual(diff.removedIndexes, [3, 4, 5]) 139 | 140 | XCTAssertEqual(diff.commonIndexes.count + diff.removedIndexes.count, old.count) 141 | XCTAssertEqual(diff.commonIndexes.count + diff.addedIndexes.count, new.count) 142 | } 143 | 144 | func testAddMultipleCopiesStart() { 145 | let old: LinkedList = [0, 1, 2] 146 | let new: LinkedList = [3, 3, 0, 1, 2] 147 | let diff = Diff(old, new) 148 | 149 | XCTAssertEqual(diff.commonIndexes, [0, 1, 2]) 150 | XCTAssertEqual(diff.addedIndexes, [0, 1]) 151 | XCTAssertEqual(diff.removedIndexes, []) 152 | 153 | XCTAssertEqual(diff.commonIndexes.count + diff.removedIndexes.count, old.count) 154 | XCTAssertEqual(diff.commonIndexes.count + diff.addedIndexes.count, new.count) 155 | } 156 | 157 | func testAddMultipleCopies() { 158 | let old: LinkedList = [0, 1, 2] 159 | let new: LinkedList = [3, 0, 3, 2, 3] 160 | let diff = Diff(old, new) 161 | 162 | XCTAssertEqual(diff.commonIndexes, [0, 2]) 163 | XCTAssertEqual(diff.addedIndexes, [0, 2, 4]) 164 | XCTAssertEqual(diff.removedIndexes, [1]) 165 | 166 | XCTAssertEqual(diff.commonIndexes.count + diff.removedIndexes.count, old.count) 167 | XCTAssertEqual(diff.commonIndexes.count + diff.addedIndexes.count, new.count) 168 | } 169 | 170 | func testAddMultipleCopiesEnd() { 171 | let old: LinkedList = [0, 1, 2] 172 | let new: LinkedList = [0, 1, 2, 3, 3] 173 | let diff = Diff(old, new) 174 | 175 | XCTAssertEqual(diff.commonIndexes, [0, 1, 2]) 176 | XCTAssertEqual(diff.addedIndexes, [3, 4]) 177 | XCTAssertEqual(diff.removedIndexes, []) 178 | 179 | XCTAssertEqual(diff.commonIndexes.count + diff.removedIndexes.count, old.count) 180 | XCTAssertEqual(diff.commonIndexes.count + diff.addedIndexes.count, new.count) 181 | } 182 | 183 | } 184 | 185 | // MARK: - Linked list - 186 | 187 | /// Ugly implementation of a linked list, used for testing non bidirectional collections 188 | fileprivate class LinkedList : Collection, ExpressibleByArrayLiteral { 189 | typealias Index = Int 190 | typealias SubSequence = LinkedList 191 | 192 | private var head: LinkedListNode? 193 | 194 | var startIndex: Int { 195 | return 0 196 | } 197 | 198 | var endIndex: Int { 199 | return self.count 200 | } 201 | 202 | var count: Int { 203 | var count = 0 204 | var nextNode = self.head 205 | while nextNode != nil { 206 | nextNode = nextNode?.next 207 | count += 1 208 | } 209 | return count 210 | } 211 | 212 | func index(after i: Int) -> Int { 213 | return i + 1 214 | } 215 | 216 | subscript(index: Int) -> T { 217 | var count = 0 218 | var nextNode = self.head 219 | while count != index || nextNode == nil { 220 | nextNode = nextNode?.next 221 | count += 1 222 | } 223 | return nextNode!.element 224 | } 225 | 226 | required init(arrayLiteral elements: T...) { 227 | var lastNode = self.head 228 | for element in elements { 229 | let node = LinkedListNode(element: element) 230 | if lastNode != nil { 231 | lastNode?.next = node 232 | } else { 233 | self.head = node 234 | } 235 | lastNode = node 236 | } 237 | } 238 | 239 | 240 | private class LinkedListNode { 241 | 242 | var element: T 243 | var next: LinkedListNode? 244 | 245 | init(element: T, next: LinkedListNode? = nil) { 246 | self.element = element 247 | self.next = next 248 | } 249 | 250 | } 251 | 252 | } 253 | 254 | -------------------------------------------------------------------------------- /Tests/SwiftLCS Tests/StringTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // The MIT License (MIT) 3 | // 4 | // Copyright (c) 2015 Tommaso Madonia 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | 25 | import XCTest 26 | @testable import SwiftLCS 27 | 28 | class StringTests: XCTestCase { 29 | 30 | override func setUp() { 31 | super.setUp() 32 | // Put setup code here. This method is called before the invocation of each test method in the class. 33 | } 34 | 35 | override func tearDown() { 36 | // Put teardown code here. This method is called after the invocation of each test method in the class. 37 | super.tearDown() 38 | } 39 | 40 | func testSimple() { 41 | let old = "abcdefg" 42 | let new = "hibdflm" 43 | XCTAssertEqual(old.longestCommonSubsequence(new), "bdf") 44 | } 45 | 46 | func testPrefix() { 47 | let old = "abcde" 48 | let new = "abcfg" 49 | XCTAssertEqual(old.longestCommonSubsequence(new), "abc") 50 | } 51 | 52 | func testSuffix() { 53 | let old = "abcde" 54 | let new = "fgcde" 55 | XCTAssertEqual(old.longestCommonSubsequence(new), "cde") 56 | } 57 | 58 | func testContains() { 59 | let old = "abcde" 60 | let new = "fgabcde" 61 | XCTAssertEqual(old.longestCommonSubsequence(new), "abcde") 62 | } 63 | 64 | func testEqual() { 65 | let old = "abcde" 66 | let new = "abcde" 67 | XCTAssertEqual(old.longestCommonSubsequence(new), "abcde") 68 | } 69 | 70 | func testEmpty() { 71 | let old = "abcde" 72 | let new = "" 73 | XCTAssertEqual(old.longestCommonSubsequence(new), "") 74 | XCTAssertEqual(new.longestCommonSubsequence(old), "") 75 | } 76 | 77 | func testBothEmpty() { 78 | let old = "" 79 | let new = "" 80 | XCTAssertEqual(old.longestCommonSubsequence(new), "") 81 | XCTAssertEqual(new.longestCommonSubsequence(old), "") 82 | } 83 | 84 | func testBothSingle() { 85 | let old = "a" 86 | let new = "a" 87 | XCTAssertEqual(old.longestCommonSubsequence(new), "a") 88 | XCTAssertEqual(new.longestCommonSubsequence(old), "a") 89 | } 90 | 91 | func testDifferentLengths() { 92 | let old = "abcdef" 93 | let new = "afgbc" 94 | XCTAssertEqual(old.longestCommonSubsequence(new), "abc") 95 | XCTAssertEqual(new.longestCommonSubsequence(old), "abc") 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /Tests/SwiftLCS Tests/XCTestManifests.swift: -------------------------------------------------------------------------------- 1 | #if !canImport(ObjectiveC) 2 | import XCTest 3 | 4 | extension ArrayTests { 5 | // DO NOT MODIFY: This is autogenerated, use: 6 | // `swift test --generate-linuxmain` 7 | // to regenerate. 8 | static let __allTests__ArrayTests = [ 9 | ("testAppend", testAppend), 10 | ("testBothEmpty", testBothEmpty), 11 | ("testBothSingle", testBothSingle), 12 | ("testContains", testContains), 13 | ("testDifferentLengths", testDifferentLengths), 14 | ("testEmpty", testEmpty), 15 | ("testEqual", testEqual), 16 | ("testPrefix", testPrefix), 17 | ("testPrependAndAppend", testPrependAndAppend), 18 | ("testSimple", testSimple), 19 | ("testSuffix", testSuffix), 20 | ] 21 | } 22 | 23 | extension BenchmarkTests { 24 | // DO NOT MODIFY: This is autogenerated, use: 25 | // `swift test --generate-linuxmain` 26 | // to regenerate. 27 | static let __allTests__BenchmarkTests = [ 28 | ("testBenchmark100", testBenchmark100), 29 | ("testBenchmark1000", testBenchmark1000), 30 | ("testBenchmark2000", testBenchmark2000), 31 | ] 32 | } 33 | 34 | extension IndexTests { 35 | // DO NOT MODIFY: This is autogenerated, use: 36 | // `swift test --generate-linuxmain` 37 | // to regenerate. 38 | static let __allTests__IndexTests = [ 39 | ("testAddMultipleCopies", testAddMultipleCopies), 40 | ("testAddMultipleCopiesEnd", testAddMultipleCopiesEnd), 41 | ("testAddMultipleCopiesStart", testAddMultipleCopiesStart), 42 | ("testBothEmpty", testBothEmpty), 43 | ("testContains", testContains), 44 | ("testDifferentLengths", testDifferentLengths), 45 | ("testEmpty", testEmpty), 46 | ("testEqual", testEqual), 47 | ("testNSIndexSet", testNSIndexSet), 48 | ("testPrefix", testPrefix), 49 | ("testSimple", testSimple), 50 | ("testSuffix", testSuffix), 51 | ] 52 | } 53 | 54 | extension LinkedListTests { 55 | // DO NOT MODIFY: This is autogenerated, use: 56 | // `swift test --generate-linuxmain` 57 | // to regenerate. 58 | static let __allTests__LinkedListTests = [ 59 | ("testAddMultipleCopies", testAddMultipleCopies), 60 | ("testAddMultipleCopiesEnd", testAddMultipleCopiesEnd), 61 | ("testAddMultipleCopiesStart", testAddMultipleCopiesStart), 62 | ("testBothEmpty", testBothEmpty), 63 | ("testContains", testContains), 64 | ("testDifferentLengths", testDifferentLengths), 65 | ("testEmpty", testEmpty), 66 | ("testEqual", testEqual), 67 | ("testPrefix", testPrefix), 68 | ("testSimple", testSimple), 69 | ("testSuffix", testSuffix), 70 | ] 71 | } 72 | 73 | extension StringTests { 74 | // DO NOT MODIFY: This is autogenerated, use: 75 | // `swift test --generate-linuxmain` 76 | // to regenerate. 77 | static let __allTests__StringTests = [ 78 | ("testBothEmpty", testBothEmpty), 79 | ("testBothSingle", testBothSingle), 80 | ("testContains", testContains), 81 | ("testDifferentLengths", testDifferentLengths), 82 | ("testEmpty", testEmpty), 83 | ("testEqual", testEqual), 84 | ("testPrefix", testPrefix), 85 | ("testSimple", testSimple), 86 | ("testSuffix", testSuffix), 87 | ] 88 | } 89 | 90 | public func __allTests() -> [XCTestCaseEntry] { 91 | return [ 92 | testCase(ArrayTests.__allTests__ArrayTests), 93 | testCase(BenchmarkTests.__allTests__BenchmarkTests), 94 | testCase(IndexTests.__allTests__IndexTests), 95 | testCase(LinkedListTests.__allTests__LinkedListTests), 96 | testCase(StringTests.__allTests__StringTests), 97 | ] 98 | } 99 | #endif 100 | --------------------------------------------------------------------------------