-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from atrinh0/main
Add iOS 15 Swift Playgrounds 4 version
- Loading branch information
Showing
15 changed files
with
297 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
7-swiftui-swift-playgrounds-4/ListApp.swiftpm/.swiftpm/playgrounds/CachedManifest.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
19 changes: 19 additions & 0 deletions
19
7-swiftui-swift-playgrounds-4/ListApp.swiftpm/.swiftpm/playgrounds/DocumentThumbnail.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Binary file added
BIN
+62.8 KB
...-swift-playgrounds-4/ListApp.swiftpm/.swiftpm/playgrounds/DocumentThumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions
13
7-swiftui-swift-playgrounds-4/ListApp.swiftpm/.swiftpm/playgrounds/Workspace.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
15 changes: 15 additions & 0 deletions
15
...ui-swift-playgrounds-4/ListApp.swiftpm/Assets.xcassets/AccentColor.colorset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
103 changes: 103 additions & 0 deletions
103
...ftui-swift-playgrounds-4/ListApp.swiftpm/Assets.xcassets/AppIcon.appiconset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
Binary file added
BIN
+133 KB
...iftpm/Assets.xcassets/AppIcon.appiconset/PlaceholderAppIcon-movie-reel-1024.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+19 KB
...ftpm/Assets.xcassets/AppIcon.appiconset/PlaceholderAppIcon-movie-reel-60@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+34 KB
...ftpm/Assets.xcassets/AppIcon.appiconset/PlaceholderAppIcon-movie-reel-60@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+26.7 KB
...ftpm/Assets.xcassets/AppIcon.appiconset/PlaceholderAppIcon-movie-reel-76@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+31.1 KB
...pm/Assets.xcassets/AppIcon.appiconset/PlaceholderAppIcon-movie-reel-83.5@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions
6
7-swiftui-swift-playgrounds-4/ListApp.swiftpm/Assets.xcassets/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
50
7-swiftui-swift-playgrounds-4/ListApp.swiftpm/ContentView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
10
7-swiftui-swift-playgrounds-4/ListApp.swiftpm/ListApp.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
41
7-swiftui-swift-playgrounds-4/ListApp.swiftpm/Package.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: "." | ||
) | ||
] | ||
) |