{"id":13465317,"url":"https://github.com/Frugghi/SwiftLCS","last_synced_at":"2025-03-25T16:31:36.935Z","repository":{"id":56922287,"uuid":"44282579","full_name":"Frugghi/SwiftLCS","owner":"Frugghi","description":"Swift implementation of the longest common subsequence (LCS) algorithm.","archived":false,"fork":false,"pushed_at":"2019-08-11T18:16:14.000Z","size":209,"stargazers_count":213,"open_issues_count":1,"forks_count":17,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-22T01:41:40.760Z","etag":null,"topics":["algorithm","diff","lcs","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Frugghi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"custom":["https://www.buymeacoffee.com/frugghi"]}},"created_at":"2015-10-14T23:46:39.000Z","updated_at":"2024-10-17T01:39:34.000Z","dependencies_parsed_at":"2022-08-21T04:50:20.217Z","dependency_job_id":null,"html_url":"https://github.com/Frugghi/SwiftLCS","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frugghi%2FSwiftLCS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frugghi%2FSwiftLCS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frugghi%2FSwiftLCS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frugghi%2FSwiftLCS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Frugghi","download_url":"https://codeload.github.com/Frugghi/SwiftLCS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245500228,"owners_count":20625528,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","diff","lcs","swift"],"created_at":"2024-07-31T15:00:27.074Z","updated_at":"2025-03-25T16:31:36.561Z","avatar_url":"https://github.com/Frugghi.png","language":"Swift","funding_links":["https://www.buymeacoffee.com/frugghi"],"categories":["Libs","Algorithm [🔝](#readme)","Data and Storage"],"sub_categories":["Algorithm"],"readme":"# SwiftLCS\n[![Build Status](https://travis-ci.org/Frugghi/SwiftLCS.svg?branch=master)](https://travis-ci.org/Frugghi/SwiftLCS)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Pods](https://img.shields.io/cocoapods/v/SwiftLCS.svg)](https://cocoapods.org/pods/SwiftLCS)\n[![Pod platforms](https://img.shields.io/cocoapods/p/SwiftLCS.svg)](https://cocoapods.org/pods/SwiftLCS)\n\nSwitLCS provides an extension of `Collection` that finds the indexes of the longest common subsequence with another collection.\n\nThe **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.\n\nThe project is based on the Objective-C implementation of [NSArray+LongestCommonSubsequence](https://github.com/khanlou/NSArray-LongestCommonSubsequence).\n\n## :package: Installation\n\n### CocoaPods\n[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.\n\nAdd this to your *Podfile*:\n```Ruby\nuse_frameworks!\n\npod 'SwiftLCS'\n```\n\n### Carthage\n[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.\n\nAdd this to your *Cartfile*:\n```Ruby\ngithub \"Frugghi/SwiftLCS\"\n```\n\n### Swift Package Manager\nThe [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.\n\nAdd `SwiftLCS` to your *Package.swift* dependencies:\n```Swift\nimport PackageDescription\n\nlet package = Package(\n    dependencies: [\n        .Package(url: \"https://github.com/Frugghi/SwiftLCS.git\", majorVersion: 1, minor: 3)\n    ]\n)\n```\n\n### Manual\nInclude `SwiftLCS.swift` into your project.\n\n## :book: Documentation\nThe API documentation is available [here](https://frugghi.github.io/SwiftLCS/).\n\n## :computer: Usage\nImport the framework:\n```Swift\nimport SwiftLCS\n```\n\n### String\n```Swift\nlet x = \"abracadabra\"\nlet y = \"yabbadabbadoo\"\n\nlet z = x.longestCommonSubsequence(y) // abadaba\n```\n\n### Array\n```Swift\nlet x = [1, 2, 3, 4, 5, 6, 7]\nlet y = [8, 9, 2, 10, 4, 11, 6, 12]\n\nlet z = x.longestCommonSubsequence(y) // [2, 4, 6]\n```\n\n### Indexes\n```Swift\nlet x = [1, 2, 3, 4, 5, 6, 7]\nlet y = [8, 9, 2, 10, 4, 11, 6, 12]\n\nlet diff = x.diff(y)\n// diff.commonIndexes: [1, 3, 5]\n// diff.addedIndexes: [0, 1, 3, 5, 7]\n// diff.removedIndexes: [0, 2, 4, 6]\n```\n\n## :warning: Objective-C\n[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.\n\n## :page_facing_up: License [![LICENSE](https://img.shields.io/cocoapods/l/SwiftLCS.svg)](https://raw.githubusercontent.com/Frugghi/SwiftLCS/master/LICENSE)\n*SwiftLCS* is released under the MIT license. See [LICENSE](https://raw.githubusercontent.com/Frugghi/SwiftLCS/master/LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFrugghi%2FSwiftLCS","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFrugghi%2FSwiftLCS","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFrugghi%2FSwiftLCS/lists"}