Skip to content

Commit

Permalink
Merge pull request #36 from dscyrescotti/develop
Browse files Browse the repository at this point in the history
[Release] To prepare the release of v1.0.1
  • Loading branch information
dscyrescotti authored Apr 1, 2023
2 parents 0b142c6 + 71a9c37 commit 6aff70e
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 15 deletions.
20 changes: 20 additions & 0 deletions ContributorUI.podspec
Original file line number Diff line number Diff line change
@@ -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
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,14 @@ ContributorList(owner: <owner>,repo: <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

Expand All @@ -93,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)

<p>
<a href="https://twitter.com/dscyrescotti">
<img src="https://img.shields.io/twitter/follow/dscyrescotti.svg?style=social">
</a>
&nbsp;
<a href="https://mastodon.social/@dscyrescotti">
<img src="https://img.shields.io/mastodon/follow/109981804502597931?domain=https%3A%2F%2Fmastodon.social&style=social">
</a>
&nbsp;
<a href="https://github.com/dscyrescotti">
<img src="https://img.shields.io/github/followers/dscyrescotti.svg?style=social&label=Follow">
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ public struct ContributorCard: View {
ForEach(0..<count, id: \.self) { _ in
Rectangle()
.foregroundColor(.gray.opacity(0.4))
.frame(width: size, height: size)
.shimmering()
.frame(width: size, height: size)
.clipShape(configuration.avatarStyle.shape())
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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")
Expand All @@ -77,7 +77,7 @@ public struct ContributorList: View {
}
}
}
}
})
#endif
}
.task {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,21 @@ struct GridListContainer: View, ListContainer {
VStack(spacing: 10) {
Rectangle()
.foregroundColor(.gray.opacity(0.4))
.frame(width: size, height: size)
.shimmering()
.frame(width: size, height: size)
.clipShape(configutation.avatarStyle.shape())
.fixedSize()
VStack(spacing: 2) {
Capsule()
.foregroundColor(.gray.opacity(0.4))
.frame(width: 80, height: size * 0.11)
.shimmering()
.frame(width: 80, height: size * 0.11)
.clipShape(Capsule())
if configutation.showsCommits {
Capsule()
.foregroundColor(.gray.opacity(0.4))
.frame(width: 60, height: size * 0.08)
.shimmering()
.frame(width: 60, height: size * 0.08)
.clipShape(Capsule())
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,21 @@ struct TableListContainer: View, ListContainer {
HStack(spacing: 10) {
Rectangle()
.foregroundColor(.gray.opacity(0.4))
.frame(width: size, height: size)
.shimmering()
.frame(width: size, height: size)
.clipShape(configutation.avatarStyle.shape())
.fixedSize()
VStack(alignment: .leading, spacing: 5) {
Capsule()
.foregroundColor(.gray.opacity(0.4))
.frame(width: 150, height: size * 0.3)
.shimmering()
.frame(width: 150, height: size * 0.3)
.clipShape(Capsule())
if configutation.showsCommits {
Capsule()
.foregroundColor(.gray.opacity(0.4))
.frame(width: 60, height: size * 0.2)
.shimmering()
.frame(width: 60, height: size * 0.2)
.fixedSize()
.clipShape(Capsule())
}
Expand Down
25 changes: 25 additions & 0 deletions Sources/ContributorUI/ContributorUI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,35 @@

import Foundation

class ContributorUIBundle { }

public struct ContributorUI {
static var TOKEN_KEY: String?

static public func configure(with token: String?) {
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")
}()
}

0 comments on commit 6aff70e

Please sign in to comment.