Swiftpack.co - Package - danielsaidi/SwiftUIKit

Version Swift UI Swift 5.2 License Twitter: @danielsaidi

About SwiftUIKit

SwiftUIKit adds functionality to SwiftUI, both things that most probably will be part of the SwiftUI in the next upcoming versions, as well as custom useful functionality.

You can read more about the different parts of SwiftUIKit in separate readmes:

As things that exist in this library are added to SwiftUI, 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 SwiftUIKit.xcodeproj project.

Installation

Swift Package Manager

https://github.com/danielsaidi/SwiftUIKit.git

CocoaPods

pod DSSwiftUIKit

Note that you have to import SwiftUIKit with import DSSwiftUIKit if you add it with CocoaPods. The name SwiftUIKit was (not surprising) already taken.

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 a SwiftUI toast, I'm not going to dig around in SwiftUIKit for one, but rather use the best single-purpose toast library.

The GitHub stars confirm this as well. Many years ago, I started putting reusable iOS functionality into a library I call 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:

License

SwiftUIKit is available under the MIT license. See LICENSE file for more info.

Github

link
Stars: 126

Dependencies

Used By

Total: 0

Releases

- 2020-09-14 19:28:34

This version adds a DocumentCamera view, which can be used to scan documents with the device camera.

- 2020-09-14 18:35:43

This version adds a dismiss function to PresentationContext.

This means that these contexts get access to this function:

  • AlertContext
  • SheetContext
  • ToastContext

- 2020-09-05 09:26:47

This version adds improved support for watchOS, tvOS and macOS.

The bump version process has been improved tp also add linting and a unit test confirmation.

- 2020-09-03 12:03:49

There are now more convenient alert, sheet and toast view modifiers, that take a context instead of a binding and a content.

This version contains more breaking changes for the toast components.

  • ToastContext works just like SheetContext and AlertContext.
  • ToastContext, SheetContext and AlertContext share a base class.
  • There is a new ToastProvider that can be used with ToastContext.
  • The toast modifier handles presenting and dismissing the toast.
  • The Toast view has been removed, since it's no longer needed.

You can now use any views with the toast context and modifier, so it should make the toast easier to understand and to use.

- 2020-09-02 19:44:14

This release renames the alert and sheet Presentable protocols to Provider.

The old Presentable protocols are marked as deprecated.

- 2020-09-02 08:10:34

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.

- 2020-09-02 08:10:20

This release adds:

  • An AlertContext that simplifies working with alerts.
  • A SheetContext that simplifies working with modal sheets.
  • A QrCodeGenerator and a StandardQrCodeGenerator implementation.

- 2020-09-02 08:10:10

This release adds:

  • A DismissableView view protocol that simplifies dismissing views programatically.
  • A KeyboardAvoiding modifier and view extension.
  • A MultilineTextView that wraps a UITextView.

- 2020-09-02 08:10:00

This release:

  • adds support for macOS, and disables a bunch of features that require UIKit.
  • adjusts the Toast so that it fits better with the alert and sheet contexts.
  • adds a new UIViewWrapper that simplifies wrapping UIKit views.

- 2020-09-02 08:09:33

This release fixes invalid iOS platform version build problems and adds a Color+Random extension.

- 2020-03-30 13:24:59

This release changes the View geometry extensions and replaces bindGeometry(to: ...) with:

  • bindSafeAreaInsets(to: ...)
  • bindSize(to: ...)

You can use them like this:

@State private var size: CGSize = .zero
@State private var size: CGSize = .zero

UIColor.red.bindGeometry(to: $height) { $0.size.height }

- 2020-03-30 13:24:44

This release makes the podspec is updated to require Swift 5.2.

- 2020-03-26 15:59:04

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.

- 2020-03-19 23:57:06

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.

- 2020-03-10 16:20:14

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.

- 2020-03-10 16:16:27

This is the very first release of SwiftUIKit. It contains a bunch of features, which are described in the readme.