SwiftNEWKit

Accelerated by Apple SwiftUI

CleanShot 2022-06-11 at 22 54 15@2x

Aims

Provide an easy way for Apple Developers to Show “What’s New” to the end users.

Features

  • Auto trigger the .sheet from Version and/or Build increase
  • One-line coding
  • JSON compatible
  • Versioning
  • Local available
  • Simple Binding
  • Simple Model
  • Open source

Version

GitHub release (latest by date) GitHub release (latest by date including pre-releases)

swiftui-128x128_2x

Environment

Tested on Latest Compatible
iOS 16 > 14
iPadOS 16 > 14
macOS 13 > 11

Guide

English | 中文 | Feel free to add new language(s) via pull requests

Get Started

Full Tutorial: https://bit.ly/3NOvJB8

Setup

Steps Description Screenshot
1 Navigate to root project CleanShot 2022-06-11 at 17 39 39@2x
2 Select Project CleanShot 2022-06-11 at 17 39 48@2x
3 Select Package Dependencies CleanShot 2022-06-11 at 17 39 53@2x
4 Click + and paste https://github.com/1998code/SwiftNEWKit to the searchbox CleanShot 2022-06-11 at 17 39 32@2x
5 Create a new file called data.json You may copy the JSON sample below.

Major Usage

  1. Import first.
import SwiftNEW
  1. Then, paste this code inside body or any some View.
SwiftNEW(show: $showNew, align: $align, color: $color, size: $size, label: $label, labelImage: $labelImage)

State

var Suggested Options Type
showNew false false, true Bool
align .center .leading, .center, .trailing HorizontalAlignment
color .accentColor All Colors Supported Color
size “normal” “mini”, “normal” String
label “Show Release Note” All Strings String
labelImage “arrow.up.circle.fill” All SF Symbols String
Samples:

@State var showNew: Bool = false
@State var align: HorizontalAlignment = .center
@State var color: Color = .accentColor
@State var size: String = "normal"
@State var label: String = "Show Release Note"
@State var labelImage: String = "arrow.up.circle.fill"

JSON

Structure / Model

public struct Vmodel: Codable, Hashable {
    var version: String
    var new: [Model]
}
public struct Model: Codable, Hashable {
    var icon: String
    var title: String
    var subtitle: String
    var body: String
}

Sample

68747470733a2f2f76616c696461746f722e737761676765722e696f2f76616c696461746f723f75726c3d68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f4f41492f4f70656e4150492d53706563696669636174696f6e2f6d61737465722f6578616d706c65732f76

[
    {
        "version": "1.1",
        "new": [{
            "icon": "pencil.and.ruler.fill",
            "title": "Apple Pencil 3",
            "subtitle": "Supported",
            "body": "Available for the new iPad Pro"
        },
            {
                "icon": "hammer.fill",
                "title": "Bug fixes",
                "subtitle": "Broken UI",
                "body": "Available for iOS 16, iPadOS 16, macOS 13"
            },
            {
                "icon": "square.and.arrow.down.fill",
                "title": "Local File",
                "subtitle": "Supported",
                "body": "Direct load via local storage. Super fast!"
            },
            {
                "icon": "macpro.gen3.server",
                "title": "Serverless",
                "subtitle": "Design",
                "body": "Free and open source! Created by Ming with ❤️‍?"
            },
            {
                "icon": "arrow.triangle.pull",
                "title": "Contribute",
                "subtitle": "Together",
                "body": "Pull requests and make it better for everyone!"
            }
        ]
    }
]

Developer Note

  • Please report bugs in Issues section.
  • If you want to discuss future roadmap or contribution, please find on Discussions.

Preview

IMG_3472 IMG_3471
Light Native Dark Native

Demo

Path: ./Demo

License

MIT

GitHub

View Github