kenny lemon
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# CS193P - Lecture 1: Getting started with SwiftUI - 82 mins * Demo code at `cs193p.stanford.edu` * How-to and How-things-work course * How SwiftUI is doing what it's doing * Prerequisites for student for this course is at least 3 and recommend 4 intro CS courses. * * They are relatively experienced programmers. * Object-oriented programming * Swift # ## [05:30](https://youtu.be/bqu6BquVi2M&t=5m30s) * Simulators on iPhone 11 and iPhone 8 * The demo app is called Memorize, the course will create the app as home work. * A card matching game * Animation is very easy to do in SwiftUI * Do rotation in simulator then the card resize themselves a little bit. # ## [12:00](https://youtu.be/bqu6BquVi2M&t=12m00s) * Intro about Xcode and how to download it # ## [13:50](https://youtu.be/bqu6BquVi2M&t=13m50s) * Intro the splash screen of Xcode * Source control and repository will be involved later. # ## [14:50](https://youtu.be/bqu6BquVi2M&t=14m50s) * Hands on creating a new project * "Choose a template for your new project” in create a new project dialog, and choose iOS project to create. * Explanation about all those fields in the "Choose options for your new proeject" dialog, e.g. Team, Organization Identifier...etc. and covention about those value. # ## [19:40](https://youtu.be/bqu6BquVi2M&t=19m40s) * Where you going to put this thing in your file system? * Stongly recommend to put in you home directory in a folder called Developer. # ## [21:20](https://youtu.be/bqu6BquVi2M&t=21m20s) * Wola, the project create successfully. * Briefly introduction about Xcode UI buttons...etc. * Desmonstrate * prees play button to start the app simulation * launch the simulater * stop button # ## [23:50](https://youtu.be/bqu6BquVi2M&t=23m50s) * Introduciton about **Navigator** in the Xcode. * default is the one to navigate by file. * Introduction about the **Inspector** in the Xcode, and will talk about it later. * Main editting window. Previewer which previews your UI. * Code editing, preview and inspector are stay in sync. Basic manipulation in real project. * [29:30](https://youtu.be/bqu6BquVi2M&t=29m30s) Assets.xcassests, which is like images, sounds and videos, those kind of assets. * [30:43](https://youtu.be/bqu6BquVi2M&t=30m43s) Info.plist, essentially the setting of your app, we usually don't edit it directly. * [32:10](https://youtu.be/bqu6BquVi2M&t=32m10s) main program, @main * [35:30](https://youtu.be/bqu6BquVi2M&t=35m30s) struct. Not only parameters, we can also have function in struct. And functional programming. * Swift support both object-oriented programming and functional programming. * **:View** behind ContentView, to make the contentview behave like a view. The only one thing you have to do to behave like a view is to have the variable "**body**". * A view can display things inside the rectangle area and receive input from the user in the form of multi-touch events, e.g. tap, swipe, pinch, things like that. ```swift= struct ContentView: View { var body: some View { // } } ``` * [43:00](https://youtu.be/bqu6BquVi2M&t=43m00s) Intro to variable. * The keyword "**some**". var body: some View, the type of this body is something that behaves like a View. The body view is always going to be a combiner View. * "some view" is like some advice to the compiler, "Hey, this variable's type is going to be some view. Please go figure out what it actually is and replace it with that when you compile it" 1. Just a declaration, this is going to be some combiner view. 2. We are going to make the code in the function more and more complicated, and make the compiler to do what it is good at. * In the body, we actually have a "**return**" statement, and the return just be hidden by Swift just to make the world look a little nicer. * The body is not a function with no name, takes no arguments. It returns in this case, a Text. This var body is not actually stored in memory. It's not a variable stored in memory. It's a variable that's calculated by executing this function. * The teacher spent couple minutes to use anology to introduce swift coding to lego subsequently. * [**56:00**](https://youtu.be/bqu6BquVi2M&t=56m00s) What is going on when we add modifier .padding to the Text. .padding is the way you calle a function in Swift. Default padding will be platform specific, which means the padding will be different in different platform. * The padding function returns something. And the padding is called a modifier. * What it return is something that behaves like a View. It returns a padded, modified other view which happens to be a Text in this case. The thing returned by .padding() might be "**modifiedContent**" . * reference A: [Why modfier order matters](https://www.hackingwithswift.com/books/ios-swiftui/why-modifier-order-matters) * reference B: [Understanding SwiftUI: Modfiers](https://dev.to/mtsrodrigues/understanding-swiftui-modifiers-3e50) * [01:02:00](https://youtu.be/bqu6BquVi2M&t=1h02m00s) RoundedRectangle, RoundedRectangle(cornerRadius: 25.0). We have argument with argument label "**cornerRadius**", this is becuase we might have the argument with the label speicifying the size. If we don't specifying the lable, and have RoundedRectangle(25.0), it's not clear enough what that 25.0 is. * The sample for text and color don't have the string or color lable becuase those are kinda redundant. * add modifier in "**Inspector**", once we choose a modifier, then corresponding section shows up in the "**Inspector**". * It's very common to make the modifier into a new line. * [01:09:00](https://youtu.be/bqu6BquVi2M&t=1h02m00s) ZStack, argument "alignment" and "content". A bags of lego which is called "**TupleView**", though you will never type this in your code. * ZStack stacks these views on top of each other from the device out towards the use. * [01:14:00](https://youtu.be/bqu6BquVi2M&t=1h14m00s) modifiers. If you add modifier to the ZStack, this kind of modifer gets passed on to all views inside. * Then the color of the ZStack will be the default color for those views inside that it's inheriting from its container. * [01:19:00](https://youtu.be/bqu6BquVi2M&t=1h19m00s)Trialing closure, e.g. ZStack.

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully