From 21b3df19a2236fa65f95989ab1ca40521aaf28a5 Mon Sep 17 00:00:00 2001 From: An Tran Date: Tue, 8 Dec 2020 23:41:31 +0800 Subject: [PATCH] Setup SPM for distribution --- .github/workflows/test.yml | 2 +- LeakDetector/.gitignore | 5 ----- LeakDetector/README.md | 7 ------- .../contents.xcworkspacedata | 7 +++++++ .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ .../xcshareddata/swiftpm/Package.resolved | 16 ++++++++++++++++ LeakDetectorDemo.xcodeproj/project.pbxproj | 2 -- .../contents.xcworkspacedata | 10 ++++++++++ .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ .../xcshareddata/swiftpm/Package.resolved | 16 ++++++++++++++++ LeakDetector/Package.swift => Package.swift | 0 README.md | 11 +++++++++-- .../LeakDetector/LeakDetector.swift | 0 .../Sources => Sources}/LeakDetector/Timer.swift | 0 .../LeakDetectorTests/LeakDetectorTests.swift | 0 .../LeakDetectorTests/TimerTests.swift | 0 16 files changed, 75 insertions(+), 17 deletions(-) delete mode 100644 LeakDetector/.gitignore delete mode 100644 LeakDetector/README.md create mode 100644 LeakDetectorDemo.xcodeproj/LeakDetectorDemo.xcworkspace/contents.xcworkspacedata create mode 100644 LeakDetectorDemo.xcodeproj/LeakDetectorDemo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 LeakDetectorDemo.xcodeproj/LeakDetectorDemo.xcworkspace/xcshareddata/swiftpm/Package.resolved create mode 100644 LeakDetectorDemo.xcworkspace/contents.xcworkspacedata create mode 100644 LeakDetectorDemo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 LeakDetectorDemo.xcworkspace/xcshareddata/swiftpm/Package.resolved rename LeakDetector/Package.swift => Package.swift (100%) rename {LeakDetector/Sources => Sources}/LeakDetector/LeakDetector.swift (100%) rename {LeakDetector/Sources => Sources}/LeakDetector/Timer.swift (100%) rename {LeakDetector/Tests => Tests}/LeakDetectorTests/LeakDetectorTests.swift (100%) rename {LeakDetector/Tests => Tests}/LeakDetectorTests/TimerTests.swift (100%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index eacdf4e..e556b0b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,6 +12,6 @@ jobs: uses: actions/checkout@master - name: Build and test run: | - xcodebuild clean test -project LeakDetectorDemo.xcodeproj -scheme LeakDetectorDemo -destination "${destination}" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO + xcodebuild clean test -workspace LeakDetectorDemo.xcworkspace -scheme LeakDetectorDemo -destination "${destination}" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO env: destination: ${{ matrix.destination }} \ No newline at end of file diff --git a/LeakDetector/.gitignore b/LeakDetector/.gitignore deleted file mode 100644 index 95c4320..0000000 --- a/LeakDetector/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.DS_Store -/.build -/Packages -/*.xcodeproj -xcuserdata/ diff --git a/LeakDetector/README.md b/LeakDetector/README.md deleted file mode 100644 index 0108bd9..0000000 --- a/LeakDetector/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# LeakDetectorCombine - -`LeakDetector` is based on the implementation from [leakdetector](https://github.com/duyquang91/leakdetector) packge, which in turn is derived from the implementation of a leak detecktor in [UBER's RIB](https://github.com/uber/RIBs/tree/master/ios/RIBs/Classes/LeakDetector) framework. - -Instead of depending on `RxSwift`, `LeakDetectorCombine` uses `Combine` framework instead, hence it only supports iOS 13+. - -I accidently found another implementation of this `LeakDetector` from [LifeCycleKit](https://github.com/ashare80/LifecycleKit) which shares many similar ideas. The implementation in `LifeCycleKit` has much nicer APIs though. So I recommend you to take a look at the implementation of the `LeakDetector` in `LifeCycleKit` as well. diff --git a/LeakDetectorDemo.xcodeproj/LeakDetectorDemo.xcworkspace/contents.xcworkspacedata b/LeakDetectorDemo.xcodeproj/LeakDetectorDemo.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..24ab27b --- /dev/null +++ b/LeakDetectorDemo.xcodeproj/LeakDetectorDemo.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/LeakDetectorDemo.xcodeproj/LeakDetectorDemo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/LeakDetectorDemo.xcodeproj/LeakDetectorDemo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/LeakDetectorDemo.xcodeproj/LeakDetectorDemo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/LeakDetectorDemo.xcodeproj/LeakDetectorDemo.xcworkspace/xcshareddata/swiftpm/Package.resolved b/LeakDetectorDemo.xcodeproj/LeakDetectorDemo.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..cfa4fe1 --- /dev/null +++ b/LeakDetectorDemo.xcodeproj/LeakDetectorDemo.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,16 @@ +{ + "object": { + "pins": [ + { + "package": "RxSwift", + "repositoryURL": "https://github.com/ReactiveX/RxSwift", + "state": { + "branch": null, + "revision": "002d325b0bdee94e7882e1114af5ff4fe1e96afa", + "version": "5.1.1" + } + } + ] + }, + "version": 1 +} diff --git a/LeakDetectorDemo.xcodeproj/project.pbxproj b/LeakDetectorDemo.xcodeproj/project.pbxproj index 6ff1925..2fe0c3d 100644 --- a/LeakDetectorDemo.xcodeproj/project.pbxproj +++ b/LeakDetectorDemo.xcodeproj/project.pbxproj @@ -114,7 +114,6 @@ D6FEB034255EBDE3009B2235 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; D6FEB037255EBDE3009B2235 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; D6FEB039255EBDE3009B2235 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - D6FEB040255EBDFE009B2235 /* LeakDetector */ = {isa = PBXFileReference; lastKnownFileType = folder; path = LeakDetector; sourceTree = ""; }; D6FEB047255EBF50009B2235 /* DelegateViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DelegateViewController.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -297,7 +296,6 @@ isa = PBXGroup; children = ( 7F4F1C6F2562126900A90DA8 /* README.md */, - D6FEB040255EBDFE009B2235 /* LeakDetector */, D6FEB02A255EBDE1009B2235 /* LeakDetectorDemo */, 7F4F1C4E2561726C00A90DA8 /* LeakDetectorDemoUITests */, D6FEB029255EBDE1009B2235 /* Products */, diff --git a/LeakDetectorDemo.xcworkspace/contents.xcworkspacedata b/LeakDetectorDemo.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..853359f --- /dev/null +++ b/LeakDetectorDemo.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/LeakDetectorDemo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/LeakDetectorDemo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/LeakDetectorDemo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/LeakDetectorDemo.xcworkspace/xcshareddata/swiftpm/Package.resolved b/LeakDetectorDemo.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..cfa4fe1 --- /dev/null +++ b/LeakDetectorDemo.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,16 @@ +{ + "object": { + "pins": [ + { + "package": "RxSwift", + "repositoryURL": "https://github.com/ReactiveX/RxSwift", + "state": { + "branch": null, + "revision": "002d325b0bdee94e7882e1114af5ff4fe1e96afa", + "version": "5.1.1" + } + } + ] + }, + "version": 1 +} diff --git a/LeakDetector/Package.swift b/Package.swift similarity index 100% rename from LeakDetector/Package.swift rename to Package.swift diff --git a/README.md b/README.md index 2b74fee..4f6cd8a 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,16 @@ # LeakDetector - ## Introduction -This is a demo project for the [LeakDetector](https://github.com/antranapp/LeakDetectorCombine/tree/main/LeakDetector) package. +`LeakDetector` is based on the implementation from [leakdetector](https://github.com/duyquang91/leakdetector) packge, which in turn is derived from the implementation of a leak detecktor in [UBER's RIB](https://github.com/uber/RIBs/tree/master/ios/RIBs/Classes/LeakDetector) framework. + +Instead of depending on `RxSwift`, `LeakDetectorCombine` uses `Combine` framework instead, hence it only supports iOS 13+. + +I accidently found another implementation of this `LeakDetector` from [LifeCycleKit](https://github.com/ashare80/LifecycleKit) which shares many similar ideas. The implementation in `LifeCycleKit` has much nicer APIs though. So I recommend you to take a look at the implementation of the `LeakDetector` in `LifeCycleKit` as well. + +## Demo + +There is a demo project to demostrate different use cases of the library. ![demo](./Docs/demo.gif) diff --git a/LeakDetector/Sources/LeakDetector/LeakDetector.swift b/Sources/LeakDetector/LeakDetector.swift similarity index 100% rename from LeakDetector/Sources/LeakDetector/LeakDetector.swift rename to Sources/LeakDetector/LeakDetector.swift diff --git a/LeakDetector/Sources/LeakDetector/Timer.swift b/Sources/LeakDetector/Timer.swift similarity index 100% rename from LeakDetector/Sources/LeakDetector/Timer.swift rename to Sources/LeakDetector/Timer.swift diff --git a/LeakDetector/Tests/LeakDetectorTests/LeakDetectorTests.swift b/Tests/LeakDetectorTests/LeakDetectorTests.swift similarity index 100% rename from LeakDetector/Tests/LeakDetectorTests/LeakDetectorTests.swift rename to Tests/LeakDetectorTests/LeakDetectorTests.swift diff --git a/LeakDetector/Tests/LeakDetectorTests/TimerTests.swift b/Tests/LeakDetectorTests/TimerTests.swift similarity index 100% rename from LeakDetector/Tests/LeakDetectorTests/TimerTests.swift rename to Tests/LeakDetectorTests/TimerTests.swift