Add project files

This commit is contained in:
Daniel Saidi 2020-04-28 10:50:03 +02:00
parent e1813ffaa6
commit 2473cf950c
16 changed files with 354 additions and 2 deletions

40
.gitignore vendored Normal file
View File

@ -0,0 +1,40 @@
# SPM defaults
.DS_Store
/.build
/Packages
.swiftpm/
# Build generated
build/
DerivedData/
# Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
# Other
*.moved-aside
*.xccheckout
*.xcscmblueprint
# Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM
# Bundler
.bundle
# Fastlane
Fastlane/report.xml
Fastlane/Preview.html
Fastlane/screenshots
Fastlane/test_output
Fastlane/README.md

8
.swiftlint.yml Normal file
View File

@ -0,0 +1,8 @@
disabled_rules:
- trailing_whitespace
- type_name
- vertical_whitespace
included:
- Sources
- Tests

24
DSSwiftKit.podspec Normal file
View File

@ -0,0 +1,24 @@
# Run `pod lib lint SwiftKit.podspec' to ensure this is a valid spec.
Pod::Spec.new do |s|
s.name = 'DSSwiftKit'
s.version = '0.1.0'
s.swift_versions = ['5.2']
s.summary = 'SwiftKit contains extra functionality for Swift.'
s.description = <<-DESC
SwiftKit contains extra functionality for Swift, like extensions, utils etc.
DESC
s.homepage = 'https://github.com/danielsaidi/SwiftKit'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'Daniel Saidi' => 'daniel.saidi@gmail.com' }
s.source = { :git => 'https://github.com/danielsaidi/SwiftKit.git', :tag => s.version.to_s }
s.social_media_url = 'https://twitter.com/danielsaidi'
s.swift_version = '5.2'
s.ios.deployment_target = '11.0'
s.tvos.deployment_target = '13.0'
s.watchos.deployment_target = '6.0'
s.source_files = 'Sources/**/*.swift'
end

31
Fastlane/Fastfile Normal file
View File

@ -0,0 +1,31 @@
fastlane_version "2.129.0"
default_platform :ios
platform :ios do
desc "Create a new version"
lane :version do |options|
ensure_git_status_clean
ensure_git_branch(branch: 'master')
bump_type = options[:type]
if bump_type == nil or bump_type.empty?
bump_type = "patch"
end
version = version_bump_podspec(path: "DSSwiftKit.podspec", bump_type: bump_type)
increment_version_number(version_number: version)
git_commit(
path: "*",
message: "Bump to #{version}"
)
add_git_tag(tag: version)
push_git_tags()
push_to_git_remote()
pod_push()
end
end

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Daniel Saidi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

27
Package.swift Normal file
View File

@ -0,0 +1,27 @@
// swift-tools-version:5.1
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "SwiftKit",
platforms: [
.iOS(.v11),
.tvOS(.v13)
.watchOS(.v13)
],
products: [
.library(
name: "SwiftKit",
targets: ["SwiftKit"]),
],
dependencies: [],
targets: [
.target(
name: "SwiftKit",
dependencies: []),
.testTarget(
name: "SwiftKitTests",
dependencies: ["SwiftKit"]),
]
)

View File

@ -1,2 +1,80 @@
# SwiftKit <p align="center">
SwiftUIKit contains additional functionality for Swift. <img src ="Resources/Logo.png" width=500 />
</p>
<p align="center">
<a href="https://github.com/danielsaidi/SwiftKit">
<img src="https://badge.fury.io/gh/danielsaidi%2FSwiftKit.svg?style=flat" alt="Version" />
</a>
<img src="https://img.shields.io/badge/platform-SwiftUI-red.svg" alt="Swift UI" />
<img src="https://img.shields.io/badge/Swift-5.1-orange.svg" alt="Swift 5.1" />
<img src="https://badges.frapsoft.com/os/mit/mit.svg?style=flat&v=102" alt="License" />
<a href="https://twitter.com/danielsaidi">
<img src="https://img.shields.io/badge/contact-@danielsaidi-blue.svg?style=flat" alt="Twitter: @danielsaidi" />
</a>
</p>
## About SwiftKit
`SwiftKit` adds functionality to `Swift`, both extensions to existing types and components, as well as custom useful functionality.
You can read more about the different parts of `SwiftKit` in separate readmes:
* [Extensions][Extensions]
If things that exist in this library are added to `Swift`, the corresponding functionality in this library will be deprecated and refer to those new features.
## Demo App
This project contains a demo app that shows all available system blur styles. To run the demo app, just open and run the `SwiftKit.xcodeproj` project.
## Installation
### Swift Package Manager
```
https://github.com/danielsaidi/SwiftKit.git
```
### CocoaPods
```
pod DSSwiftKit
```
## <a name="why"></a>Why a big "Kit"?
Having a big "kit" is a bad idea, since it may become too generic and hard to overview. For instance, if I want to modify dates, I'm probably not going to dig around in SwiftKit looking for extensions, but rather use the best single-purpose date library.
The GitHub stars confirm this as well. Many years ago, I started putting reusable iOS functionality into a library I call [iExtra](https://github.com/danielsaidi/iExtra). I think it's an amazing library and I use it in most of my apps. To this day, it has 12 stars.
However, each project comes with overhead. If I decided to create a new library for each little thing I make, I'd spend a lot of time setting up each new project. There are funny names to come up with, icons and logos to be made, maintenance etc.
SO instead of honoring every little idea with a new library, I'm going to put most here until they are either too large or too good to be a part of this library. When that happens, they'll break out of their little cage and move into a library of their own.
## Contact me
Feel free to reach out if you have questions or if you want to contribute in any way:
* E-mail: [daniel.saidi@gmail.com][Email]
* Twitter: [@danielsaidi][Twitter]
* Web site: [danielsaidi.com][Website]
## License
SwiftKit is available under the MIT license. See [LICENSE][License] file for more info.
[Email]: mailto:daniel.saidi@gmail.com
[Twitter]: http://www.twitter.com/danielsaidi
[Website]: http://www.danielsaidi.com
[GitHub]: https://github.com/danielsaidi/SwiftKit
[License]: https://github.com/danielsaidi/SwiftKit/blob/master/LICENSE
[Extensions]: Readmes/Extensions.md

5
Readmes/Extensions.md Normal file
View File

@ -0,0 +1,5 @@
# Extension
`SwiftKit` contains additional logic in the form of extensions to native `Swift` types.
Since this namespace will probably grow much and fast, extensions are not listed or described here. Instead, have a look at the source code to see what kind of extensions this library contains. They should all be pretty well documented.

84
Release Notes.md Normal file
View File

@ -0,0 +1,84 @@
# Release notes
## 0.5.0
This release adds:
* An `ImagePicker` that can be used to present a `UIImagePickerController`.
* An `FilePicker` that can be used to present a `UIDocumentPickerViewController`.
* An `ShareSheet` that can be used to present a `UIActivityViewController`.
* An `UserDefaultsPersisted` property wrapper that lets you persist data to `UserDefaults`.
## 0.4.1
This release changes the `View` geometry extensions and replaces `bindGeometry(to: ...)` with:
* `bindSafeAreaInsets(to: ...)`
* `bindSize(to: ...)`
You can use them like this:
```swift
@State private var size: CGSize = .zero
@State private var size: CGSize = .zero
UIColor.red.bindGeometry(to: $height) { $0.size.height }
```
## 0.4.0
This release adds a new geometry `View` extension:
* `bindGeometry(to: ...)` lets you bind any `CGFloat` geometry value for a view.
The extension injects a `GeometryReader` and provides values to the provided binding.
## 0.3.0
This release adds some new toast features:
* `ToastContext` is an observable object can be used to manage a view's toast.
* `ToastStyle` is a new struct that contains all available styles for a toast.
This release makes some small api changes:
* The `SwipeGesture` initializer has been made public.
* `Toast` now uses `ToastStyle` instead of separate style properties.
* The `Toast` extensions now require you to specify a background.
* The text-based `Toast` extension automatically centers the text.
## 0.2.1
This release adds a new `FontIdentifier`.
It can be implemented by any font provider, e.g. `SwiftGen`s `FontConvertible`.
## 0.2.0
This release adds new style structs:
* `CornerRadiusStyle` style can be used to specify corner radii.
* `FontStyle` style can be used to specify custom fonts.
* `ShadowStyle` style can be used to specify drop shadow styles.
These view modifiers simplifies using these styles:
* `cornerRadius(_ style:)` can be used to apply a `CornerRadiusStyle`.
* `font(_ style: FontStyle)` can be used to apply a `FontStyle`.
* `font(name:, style:, weight:)` can also be used to apply custom fonts.
* `shadow(_ style:)` can be used to apply a `ShadowStyle`.
The release also adds new view extensions:
* `blur(...)` simplifies using the system blur styles that are specified in this library.
* `border(content:,width:,cornerRadius:)` can be used to apply borders with a certain content (e.g. Color.red), width and corner radius.
## 0.1.0
This is the very first release of SwiftUIKit. It contains a bunch of features, which are described in the readme.

BIN
Resources/Icon.sketch Normal file

Binary file not shown.

BIN
Resources/Logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 KiB

BIN
Resources/Logo.sketch Normal file

Binary file not shown.

View File

@ -0,0 +1,3 @@
struct SwiftKit {
var text = "Hello, World!"
}

7
Tests/LinuxMain.swift Normal file
View File

@ -0,0 +1,7 @@
import XCTest
import SwiftKitTests
var tests = [XCTestCaseEntry]()
tests += SwiftKitTests.allTests()
XCTMain(tests)

View File

@ -0,0 +1,15 @@
import XCTest
@testable import SwiftKit
final class SwiftKitTests: XCTestCase {
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct
// results.
XCTAssertEqual(SwiftKit().text, "Hello, World!")
}
static var allTests = [
("testExample", testExample),
]
}

View File

@ -0,0 +1,9 @@
import XCTest
#if !canImport(ObjectiveC)
public func allTests() -> [XCTestCaseEntry] {
return [
testCase(SwiftKitTests.allTests),
]
}
#endif