From 5383e3ae0ae99b40d1eb0bec84aa3adb5fdb5992 Mon Sep 17 00:00:00 2001 From: dscyrescotti Date: Thu, 30 Mar 2023 11:38:09 +0630 Subject: [PATCH 1/4] add cocoapod support --- ContributorUI.podspec | 20 +++++++++++++++ .../ContributorList/ContributorList.swift | 12 ++++----- Sources/ContributorUI/ContributorUI.swift | 25 +++++++++++++++++++ 3 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 ContributorUI.podspec diff --git a/ContributorUI.podspec b/ContributorUI.podspec new file mode 100644 index 0000000..eddefad --- /dev/null +++ b/ContributorUI.podspec @@ -0,0 +1,20 @@ +Pod::Spec.new do |spec| + spec.name = 'ContributorUI' + spec.version = '1.0.1' + spec.license = { :type => 'MIT', :file => 'LICENSE' } + spec.homepage = 'https://github.com/dscyrescotti/ContributorUI' + spec.authors = { 'Dscyre Scotti' => 'dscyrescotti@gmail.com' } + spec.summary = 'A UI library for iOS and macOS applications to showcase all contributors of public or private repositories.' + spec.source = { :git => 'https://github.com/dscyrescotti/ContributorUI.git', :tag => 'v1.0.1' } + spec.swift_versions = ['5.7'] + + spec.ios.deployment_target = '16.0' + spec.macos.deployment_target = '13.0' + + spec.source_files = 'Sources/ContributorUI/**/*.swift' + spec.resource = 'Sources/ContributorUI/Resources/*' + + spec.framework = 'SwiftUI', 'Combine', 'Foundation' + + spec.dependency 'Kingfisher', '~> 7.6.2' +end \ No newline at end of file diff --git a/Sources/ContributorUI/Components/ContributorList/ContributorList.swift b/Sources/ContributorUI/Components/ContributorList/ContributorList.swift index 81385cb..f86ab6f 100644 --- a/Sources/ContributorUI/Components/ContributorList/ContributorList.swift +++ b/Sources/ContributorUI/Components/ContributorList/ContributorList.swift @@ -28,7 +28,7 @@ public struct ContributorList: View { .navigationTitle(configuration.navigationTitle) #if os(iOS) .navigationBarTitleDisplayMode(.inline) - .toolbar { + .toolbar(content: { ToolbarItem(placement: .navigationBarLeading) { Button("Close") { dismiss() @@ -37,14 +37,14 @@ public struct ContributorList: View { if !configuration.hidesRepoLink { ToolbarItem(placement: .navigationBarTrailing) { Link(destination: URL(string: "https://github.com/\(configuration.owner)/\(configuration.repo)")!) { - Image("github", bundle: .module) + Image("github", bundle: .contribtorUI) } .tint(.primary) } } - } + }) #else - .toolbar { + .toolbar(content: { ToolbarItem(placement: .destructiveAction) { Button("Close") { dismiss() @@ -62,7 +62,7 @@ public struct ContributorList: View { if !configuration.hidesRepoLink { ToolbarItem(placement: .primaryAction) { Link(destination: URL(string: "https://github.com/\(configuration.owner)/\(configuration.repo)")!) { - Image("github", bundle: .module) + Image("github", bundle: .contribtorUI) .foregroundColor(.primary) } .help("Visit the repository on GitHub") @@ -77,7 +77,7 @@ public struct ContributorList: View { } } } - } + }) #endif } .task { diff --git a/Sources/ContributorUI/ContributorUI.swift b/Sources/ContributorUI/ContributorUI.swift index b7e073a..53f3be4 100644 --- a/Sources/ContributorUI/ContributorUI.swift +++ b/Sources/ContributorUI/ContributorUI.swift @@ -7,6 +7,8 @@ import Foundation +class ContributorUIBundle { } + public struct ContributorUI { static var TOKEN_KEY: String? @@ -14,3 +16,26 @@ public struct ContributorUI { TOKEN_KEY = token } } + +public extension Bundle { + static var contribtorUI: Bundle = { + let bundleName = "ContributorUI_ContributorUI" + + let candidates = [ + Bundle.main.resourceURL, + Bundle(for: ContributorUIBundle.self).resourceURL, + Bundle(for: ContributorUIBundle.self).resourceURL?.deletingLastPathComponent(), + Bundle.main.bundleURL, + Bundle(for: ContributorUIBundle.self).resourceURL?.deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent(), + Bundle(for: ContributorUIBundle.self).resourceURL?.deletingLastPathComponent().deletingLastPathComponent(), + ] + + for candidate in candidates { + let bundlePathiOS = candidate?.appendingPathComponent(bundleName + ".bundle") + if let bundle = bundlePathiOS.flatMap(Bundle.init(url:)) { + return bundle + } + } + fatalError("unable to find bundle named ContributorUI_ContributorUI") + }() +} From c07a906c677dfa800d551b435edb1173116c292c Mon Sep 17 00:00:00 2001 From: dscyrescotti Date: Thu, 30 Mar 2023 11:52:16 +0630 Subject: [PATCH 2/4] update readme --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7933369..3d824aa 100644 --- a/README.md +++ b/README.md @@ -74,9 +74,14 @@ ContributorList(owner: ,repo: ) Add it as a dependency within your Package.swift. ``` dependencies: [ - .package(url: "https://github.com/dscyrescotti/ContributorUI.git", from: "1.0.0") + .package(url: "https://github.com/dscyrescotti/ContributorUI.git", from: "1.0.1") ] ``` +### 🎁 Using CocoaPods +Add it inside your Podfile. +``` +pod 'ContributorUI', '~> 1.0.1' +``` ## 🔎 Exploration From 8d04805ce44a050daea2b4112abe032aa340fb98 Mon Sep 17 00:00:00 2001 From: dscyrescotti Date: Thu, 30 Mar 2023 15:30:18 +0630 Subject: [PATCH 3/4] place shimmering modifier before frame --- .../Components/ContributorCard/ContributorCard.swift | 2 +- .../ContributorList/ListContainer/GridListContainer.swift | 6 +++--- .../ContributorList/ListContainer/TableListContainer.swift | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Sources/ContributorUI/Components/ContributorCard/ContributorCard.swift b/Sources/ContributorUI/Components/ContributorCard/ContributorCard.swift index 7ff7fb1..2aac8d9 100644 --- a/Sources/ContributorUI/Components/ContributorCard/ContributorCard.swift +++ b/Sources/ContributorUI/Components/ContributorCard/ContributorCard.swift @@ -85,8 +85,8 @@ public struct ContributorCard: View { ForEach(0.. Date: Sat, 1 Apr 2023 09:08:00 +0630 Subject: [PATCH 4/4] add mastodon link --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3d824aa..e84f05a 100644 --- a/README.md +++ b/README.md @@ -98,13 +98,17 @@ Afterwards, Xcode will open the project and then you can hit ⌘+R to run the pr **ContributorUI** is inspried by [contrib.rocks](https://contrib.rocks/) and is developed to praise the contributors of the project in iOS and macOS applications with a minimal setup. ## ✍️ Author -Scotti | [@dscyrescotti](https://twitter.com/dscyrescotti) +Dscyre Scotti | [@dscyrescotti](https://twitter.com/dscyrescotti)

  + + +