Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SwiftUI Kit, on the tube! #22

Merged
merged 6 commits into from Jul 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
@@ -1,16 +1,16 @@
# SwiftUI Kit
A SwiftUI system components and interactions demo app based on iOS 14, macOS Big Sur, and watchOS 7.
A SwiftUI system components and interactions demo app based on iOS 14, macOS Big Sur, watchOS 7, and tvOS 14.

![SwiftUI Kit](https://user-images.githubusercontent.com/110813/87210094-5accf380-c2e2-11ea-91c9-4f21aa313bc6.png)

Use the SwiftUI Kit app to see how SwiftUI views appear and interact when using the system defaults. You can view the source to see how particular examples work.

Includes Buttons, Colors, Controls, Fonts, Haptics, Images, Indicators, Shapes, and Text.
Includes Buttons, Colors, Controls, Fonts, Haptics, Images, Indicators, Shapes, Text, and more.

![SwiftUI Kit examples](https://user-images.githubusercontent.com/110813/87210295-00806280-c2e3-11ea-91e3-4ea6da79f73e.png)

#### To run
Make sure you're using [Xcode 12+](https://developer.apple.com/xcode/) as well as a device running iOS 14+. Works on iPhone, iPad, and Mac.
Make sure you're using [Xcode 12+](https://developer.apple.com/xcode/) as well as a device running iOS 14+. Works on iPhone, iPad, Mac, Apple Watch, and Apple TV.

#### Accent color
To change the accent color and see how it affects the system components, go to the AccentColor section of Assets.xcassets in Xcode. You can then change the Light and Dark accent colors that will be applied to the app.
Expand Down
@@ -0,0 +1,11 @@
{
"images" : [
{
"idiom" : "tv"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
@@ -0,0 +1,17 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"layers" : [
{
"filename" : "Front.imagestacklayer"
},
{
"filename" : "Middle.imagestacklayer"
},
{
"filename" : "Back.imagestacklayer"
}
]
}
@@ -0,0 +1,11 @@
{
"images" : [
{
"idiom" : "tv"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
@@ -0,0 +1,11 @@
{
"images" : [
{
"idiom" : "tv"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
@@ -0,0 +1,16 @@
{
"images" : [
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
@@ -0,0 +1,17 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"layers" : [
{
"filename" : "Front.imagestacklayer"
},
{
"filename" : "Middle.imagestacklayer"
},
{
"filename" : "Back.imagestacklayer"
}
]
}
@@ -0,0 +1,16 @@
{
"images" : [
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
@@ -0,0 +1,16 @@
{
"images" : [
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
32 changes: 32 additions & 0 deletions Shared/Assets.xcassets/Brand Assets.brandassets/Contents.json
@@ -0,0 +1,32 @@
{
"assets" : [
{
"filename" : "App Icon - App Store.imagestack",
"idiom" : "tv",
"role" : "primary-app-icon",
"size" : "1280x768"
},
{
"filename" : "App Icon.imagestack",
"idiom" : "tv",
"role" : "primary-app-icon",
"size" : "400x240"
},
{
"filename" : "Top Shelf Image Wide.imageset",
"idiom" : "tv",
"role" : "top-shelf-image-wide",
"size" : "2320x720"
},
{
"filename" : "Top Shelf Image.imageset",
"idiom" : "tv",
"role" : "top-shelf-image",
"size" : "1920x720"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
@@ -0,0 +1,16 @@
{
"images" : [
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
@@ -0,0 +1,16 @@
{
"images" : [
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
2 changes: 1 addition & 1 deletion Shared/ContentView.swift
Expand Up @@ -27,7 +27,7 @@ struct ContentView: View {

var body: some View {
NavigationView {
#if os(iOS) || os(watchOS)
#if os(iOS) || os(watchOS) || os(tvOS)
list.navigationBarTitle("SwiftUI")
Text("Select a group")
#elseif os(OSX)
Expand Down
6 changes: 3 additions & 3 deletions Shared/Groupings/ButtonsGroup.swift
Expand Up @@ -45,7 +45,7 @@ struct ButtonsGroup: View {
#endif
}

#if os(iOS)
majouji marked this conversation as resolved.
Show resolved Hide resolved
#if !os(OSX)
Button(action: {
self.showingActionSheet = true
}) {
Expand All @@ -64,7 +64,7 @@ struct ButtonsGroup: View {
}
)

#if os(iOS) || os(OSX)
#if !os(watchOS) && !os(tvOS)
SectionView(
title: "Link",
description: "A control for navigating to a URL.",
Expand All @@ -74,7 +74,7 @@ struct ButtonsGroup: View {
)
#endif

#if !os(watchOS)
#if !os(watchOS) && !os(tvOS)
SectionView(
title: "Menu",
description: "A control for presenting a contextually-appropriate menu of buttons.",
Expand Down
4 changes: 4 additions & 0 deletions Shared/Groupings/ControlsGroup.swift
Expand Up @@ -24,8 +24,10 @@ struct ControlsGroup: View {
Group {
Toggle("Vibrate on Ring", isOn: $vibrateOnRing)

#if !os(tvOS)
Toggle("Vibrate on Silent", isOn: $vibrateOnSilent)
.toggleStyle(SwitchToggleStyle())
#endif
}
}

Expand Down Expand Up @@ -69,13 +71,15 @@ struct ControlsGroup: View {
}
#endif

#if !os(tvOS)
SectionView(title: "Slider", description: "A control for selecting a value from a bounded linear range of values. It can slide continuously, or snap to fixed increments.") {
Group {
Slider(value: $volume, in: 0...100, minimumValueLabel: Text("0%"), maximumValueLabel: Text("100%"), label: { Text("Volume") })

Slider(value: $rating, in: 1...10, step: 1, minimumValueLabel: Text("0"), maximumValueLabel: Text("10"), label: { Text("Rating") })
}
}
#endif

#if os(iOS) || os(OSX)
SectionView(title: "Stepper", description: "A control used to perform semantic increment and decrement actions.") {
Expand Down
1 change: 1 addition & 0 deletions Shared/Groupings/ShapesGroup.swift
Expand Up @@ -8,6 +8,7 @@
import SwiftUI

struct ShapesGroup: View {

// Define constraints for the shape frames so they don’t stretch out too much on macOS
let frameMinWidth: CGFloat = 16
let frameMaxWidth: CGFloat = 256
Expand Down