Skip to content

Commit

Permalink
Merge pull request #2 from atrinh0/main
Browse files Browse the repository at this point in the history
Add iOS 15 Swift Playgrounds 4 version
  • Loading branch information
dkhamsing committed Mar 22, 2022
2 parents 375310e + f5504b9 commit 343606f
Show file tree
Hide file tree
Showing 15 changed files with 297 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CachedManifest</key>
<dict>
<key>manifestData</key>
<data>
eyJkZXBlbmRlbmNpZXMiOltdLCJuYW1lIjoiTGlzdEFwcCIsInBhY2thZ2VL
aW5kIjoicm9vdCIsInBsYXRmb3JtcyI6W3sib3B0aW9ucyI6W10sInBsYXRm
b3JtTmFtZSI6ImlvcyIsInZlcnNpb24iOiIxNS4yIn1dLCJwcm9kdWN0cyI6
W3sibmFtZSI6Ikxpc3RBcHAiLCJzZXR0aW5ncyI6W3siZGlzcGxheVZlcnNp
b24iOlsiMS4wIl19LHsiYnVuZGxlVmVyc2lvbiI6WyIxIl19LHsiaU9TQXBw
SW5mbyI6W3siYWNjZW50Q29sb3JBc3NldE5hbWUiOiJBY2NlbnRDb2xvciIs
ImNhcGFiaWxpdGllcyI6W10sImljb25Bc3NldE5hbWUiOiJBcHBJY29uIiwi
c3VwcG9ydGVkRGV2aWNlRmFtaWxpZXMiOlsicGFkIiwicGhvbmUiXSwic3Vw
cG9ydGVkSW50ZXJmYWNlT3JpZW50YXRpb25zIjpbeyJwb3J0cmFpdCI6e319
LHsibGFuZHNjYXBlUmlnaHQiOnt9fSx7ImxhbmRzY2FwZUxlZnQiOnt9fSx7
InBvcnRyYWl0VXBzaWRlRG93biI6eyJjb25kaXRpb24iOnsiZGV2aWNlRmFt
aWxpZXMiOlsicGFkIl19fX1dfV19XSwidGFyZ2V0cyI6WyJBcHBNb2R1bGUi
XSwidHlwZSI6eyJleGVjdXRhYmxlIjpudWxsfX1dLCJ0YXJnZXRNYXAiOnsi
QXBwTW9kdWxlIjp7ImRlcGVuZGVuY2llcyI6W10sImV4Y2x1ZGUiOltdLCJu
YW1lIjoiQXBwTW9kdWxlIiwicGF0aCI6Ii4iLCJyZXNvdXJjZXMiOltdLCJz
ZXR0aW5ncyI6W10sInR5cGUiOiJleGVjdXRhYmxlIn19LCJ0YXJnZXRzIjpb
eyJkZXBlbmRlbmNpZXMiOltdLCJleGNsdWRlIjpbXSwibmFtZSI6IkFwcE1v
ZHVsZSIsInBhdGgiOiIuIiwicmVzb3VyY2VzIjpbXSwic2V0dGluZ3MiOltd
LCJ0eXBlIjoiZXhlY3V0YWJsZSJ9XSwidG9vbHNWZXJzaW9uIjp7Il92ZXJz
aW9uIjoiNS41LjAifX0=
</data>
<key>manifestHash</key>
<data>
qyGzM11RynyRZ+rWWypUNBKcTN5M0E7eEG8j6PPLLdU=
</data>
<key>schemaVersion</key>
<integer>3</integer>
<key>swiftPMVersionString</key>
<string>5.5.0</string>
</dict>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DocumentThumbnailConfiguration</key>
<dict>
<key>accentColorHash</key>
<data>
sfUaUR8doM00i4+FmNsy5hy5Y+X8aeK0FIW/mVkO11o=
</data>
<key>appIconHash</key>
<data>
vFxlhWDY3fEl9wOhLn8D2hOHGb1st9MSTtrlh+PhzuY=
</data>
<key>thumbnailIsPrerendered</key>
<false/>
</dict>
</dict>
</plist>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AppSettings</key>
<dict>
<key>appIconPlaceholderGlyphName</key>
<string>movie-reel</string>
<key>appSettingsVersion</key>
<integer>1</integer>
</dict>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"colors" : [
{
"color" : {
"platform" : "universal",
"reference" : "systemRedColor"
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"images" : [
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"filename" : "PlaceholderAppIcon-movie-reel-60@2x.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"filename" : "PlaceholderAppIcon-movie-reel-60@3x.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"filename" : "PlaceholderAppIcon-movie-reel-76@2x.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"filename" : "PlaceholderAppIcon-movie-reel-83.5@2x.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"filename" : "PlaceholderAppIcon-movie-reel-1024.png",
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
50 changes: 50 additions & 0 deletions 7-swiftui-swift-playgrounds-4/ListApp.swiftpm/ContentView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import SwiftUI

struct ContentView: View {
@State var shows: [Show] = []

var body: some View {
NavigationView {
List(shows) { show in
VStack(alignment: .leading) {
Text(show.name)
Text(show.subtitle)
.foregroundColor(.secondary)
.font(.caption)
.lineLimit(4)
}
}
.navigationBarTitle("SwiftUI - iOS 15", displayMode: .inline)
.task {
await loadData()
}
.refreshable {
await loadData()
}
}
.navigationViewStyle(.stack)
}

@MainActor
func loadData() async {
guard let url = URL(string: "https://api.tvmaze.com/shows"),
let (data, _) = try? await URLSession.shared.data(for: URLRequest(url: url)),
let shows = try? JSONDecoder().decode([Show].self, from: data) else { return }
self.shows = shows
}
}

struct Show: Codable, Identifiable {
let id: Int
let name, status, premiered, summary: String
}

extension Show {
var subtitle: String {
premiered + "\n" + status + summary
.replacingOccurrences(of: "<p>", with: "\n")
.replacingOccurrences(of: "</p>", with: "\n")
.replacingOccurrences(of: "<b>", with: "")
.replacingOccurrences(of: "</b>", with: "")
}
}
10 changes: 10 additions & 0 deletions 7-swiftui-swift-playgrounds-4/ListApp.swiftpm/ListApp.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import SwiftUI

@main
struct ListApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
41 changes: 41 additions & 0 deletions 7-swiftui-swift-playgrounds-4/ListApp.swiftpm/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// swift-tools-version: 5.5

// WARNING:
// This file is automatically generated.
// Do not edit it by hand because the contents will be replaced.

import PackageDescription
import AppleProductTypes

let package = Package(
name: "ListApp",
platforms: [
.iOS("15.2")
],
products: [
.iOSApplication(
name: "ListApp",
targets: ["AppModule"],
displayVersion: "1.0",
bundleVersion: "1",
iconAssetName: "AppIcon",
accentColorAssetName: "AccentColor",
supportedDeviceFamilies: [
.pad,
.phone
],
supportedInterfaceOrientations: [
.portrait,
.landscapeRight,
.landscapeLeft,
.portraitUpsideDown(.when(deviceFamilies: [.pad]))
]
)
],
targets: [
.executableTarget(
name: "AppModule",
path: "."
)
]
)

0 comments on commit 343606f

Please sign in to comment.