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

Tutorial: Chapter 1.1 - SwiftUI / Building a Simple Todo List UI #94

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions buildDocs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

rm -rf docsData

echo "Building DocC documentation for MakeItSo..."

xcodebuild -project code/frontend/MakeItSo/MakeItSo.xcodeproj \
-derivedDataPath docsData \
-scheme MakeItSo \
-destination 'platform=iOS Simulator,name=iPhone 14 Pro' \
-parallelizeTargets docbuild

echo "Copying DocC archives to doc_archives..."

mkdir doc_archives

cp -R `find docsData -type d -name "*.doccarchive"` doc_archives

mkdir docs

for ARCHIVE in doc_archives/*.doccarchive; do
cmd() {
echo "$ARCHIVE" | awk -F'.' '{print $1}' | awk -F'/' '{print tolower($2)}'
}
ARCHIVE_NAME="$(cmd)"
echo "Processing Archive: $ARCHIVE"
$(xcrun --find docc) process-archive transform-for-static-hosting "$ARCHIVE" \
--hosting-base-path MakeItSo/ --output-path docs
done

git fetch

git stash push -u -- docs doc_archives

git checkout tutorial/pages

rm -rf docs doc_archives

git stash apply

git add docs doc_archives

git commit -m "📝 Updated DocC documentation"

# git push --set-upstream origin tutorial/pages
6 changes: 6 additions & 0 deletions code/frontend/MakeItSo/MakeItSo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
8873461229AFCB890019A853 /* MakeItSo.docc in Sources */ = {isa = PBXBuildFile; fileRef = 8873461129AFCB890019A853 /* MakeItSo.docc */; };
88955B9829AFB3DE00A6FF15 /* MakeItSoApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88955B9729AFB3DE00A6FF15 /* MakeItSoApp.swift */; };
88955B9A29AFB3DE00A6FF15 /* RemindersListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88955B9929AFB3DE00A6FF15 /* RemindersListView.swift */; };
88955B9C29AFB3DE00A6FF15 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 88955B9B29AFB3DE00A6FF15 /* Assets.xcassets */; };
Expand All @@ -16,6 +17,7 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
8873461129AFCB890019A853 /* MakeItSo.docc */ = {isa = PBXFileReference; lastKnownFileType = folder.documentationcatalog; name = MakeItSo.docc; path = MakeItSo/MakeItSo.docc; sourceTree = "<group>"; };
88955B9429AFB3DE00A6FF15 /* MakeItSo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MakeItSo.app; sourceTree = BUILT_PRODUCTS_DIR; };
88955B9729AFB3DE00A6FF15 /* MakeItSoApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MakeItSoApp.swift; sourceTree = "<group>"; };
88955B9929AFB3DE00A6FF15 /* RemindersListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemindersListView.swift; sourceTree = "<group>"; };
Expand All @@ -39,6 +41,7 @@
88955B8B29AFB3DE00A6FF15 = {
isa = PBXGroup;
children = (
8873461129AFCB890019A853 /* MakeItSo.docc */,
88955B9629AFB3DE00A6FF15 /* MakeItSo */,
88955B9529AFB3DE00A6FF15 /* Products */,
);
Expand Down Expand Up @@ -178,6 +181,7 @@
88955BA929AFB4AC00A6FF15 /* Reminder.swift in Sources */,
88955B9A29AFB3DE00A6FF15 /* RemindersListView.swift in Sources */,
88955BAC29AFB8E500A6FF15 /* AddReminderView.swift in Sources */,
8873461229AFCB890019A853 /* MakeItSo.docc in Sources */,
88955B9829AFB3DE00A6FF15 /* MakeItSoApp.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -315,6 +319,7 @@
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -344,6 +349,7 @@
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ import Foundation
struct Reminder: Identifiable {
let id = UUID()
var title: String
var completed = false
var isCompleted = false
}

extension Reminder {
static let samples = [
Reminder(title: "Build sample app", completed: true),
Reminder(title: "Build sample app", isCompleted: true),
Reminder(title: "Create tutorial"),
Reminder(title: "???"),
Reminder(title: "PROFIT!"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ struct AddReminderView: View {
@State
private var reminder = Reminder(title: "")

var completion: (_ reminder: Reminder) -> Void
var onCommit: (_ reminder: Reminder) -> Void

private func commit() {
completion(reminder)
onCommit(reminder)
dismiss()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ struct RemindersListView: View {
var body: some View {
List($reminders) { $reminder in
HStack {
Image(systemName: reminder.completed
Image(systemName: reminder.isCompleted
? "largecircle.fill.circle"
: "circle")
.foregroundColor(.accentColor)
.onTapGesture {
reminder.completed.toggle()
reminder.isCompleted.toggle()
}
Text(reminder.title)
}
Expand Down
13 changes: 13 additions & 0 deletions code/frontend/MakeItSo/MakeItSo/MakeItSo.docc/MakeItSo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# ``MakeItSo``

<!--@START_MENU_TOKEN@-->Summary<!--@END_MENU_TOKEN@-->

## Overview

<!--@START_MENU_TOKEN@-->Text<!--@END_MENU_TOKEN@-->

## Topics

### <!--@START_MENU_TOKEN@-->Group<!--@END_MENU_TOKEN@-->

- <!--@START_MENU_TOKEN@-->``Symbol``<!--@END_MENU_TOKEN@-->
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?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/>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?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>DocPrefHorizontalScrollBarValue</key>
<string>0</string>
<key>DocPrefIsAssetPanelOpen</key>
<integer>1</integer>
<key>DocPrefIsCanvasRulersEnabled</key>
<integer>0</integer>
<key>DocPrefIsCaptionEditorOpen</key>
<integer>0</integer>
<key>DocPrefIsPropertiesOpen</key>
<integer>1</integer>
<key>DocPrefIsTocOpen</key>
<integer>0</integer>
<key>DocPrefMainSplitterValue</key>
<string>1057.00000000000000000000</string>
<key>DocPrefPlayheadTime</key>
<string>11195520000</string>
<key>DocPrefPreviewAutoFit</key>
<integer>1</integer>
<key>DocPrefPreviewScaleValue</key>
<string>0.40991379310344827624</string>
<key>DocPrefTrackHeaderWidth</key>
<string>80.00000000000000000000</string>
<key>DocPrefTrackHeights</key>
<array>
<integer>54</integer>
<integer>54</integer>
</array>
<key>DocPrefWindowSizePos</key>
<string>0 0 3840 2135 0 0 3840 2135 </string>
<key>DocPrefZoomValue</key>
<string>1.95010395010394987914</string>
<key>SaveAsStandaloneProject</key>
<real>1</real>
</dict>
</plist>
Loading