This repository has been archived by the owner on Aug 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/cis1951/website
- Loading branch information
Showing
26 changed files
with
1,080 additions
and
52 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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 |
---|---|---|
@@ -1,8 +1,121 @@ | ||
--- | ||
title: "HW0: Xcode Setup" | ||
isReleased: false | ||
releaseDate: 2024-01-18T19:00:00-05:00 | ||
title: "HW0: Environment Setup" | ||
isReleased: true | ||
dueDate: 2024-01-29T23:59:00-05:00 | ||
--- | ||
|
||
Just send us a screenshot of Xcode working | ||
[Submit this assignment on Canvas.](https://canvas.upenn.edu/courses/1774063/assignments/12057154) | ||
|
||
Authors: [Jerry Ye](https://github.com/jerry1ye10), [Yuying Fan](https://github.com/fyy26) | ||
|
||
Reviewers: [Anthony Li](https://github.com/anli5005), [Jordan Hochman](https://github.com/jhawk0224) | ||
|
||
Please leave feedback by posting on Ed or contacting the [course staff](/). | ||
|
||
**Expected Duration:** 10-15 minutes of engagement. 1+ hours of installing & updating software if required. | ||
|
||
**Deadline:** <FormattedDate date={new Date("2024-01-29T23:59:00-05:00")} format="EEEE, M/d @ p" /> | ||
|
||
- - - - | ||
|
||
## Objectives | ||
|
||
* Learn some vocabulary. | ||
* Ensure your Xcode is set up correctly. | ||
* Make sure you can run apps using the virtual iPhone simulator. | ||
* Meet the _Playground_ — a “scratch pad“ to quickly experiment with Swift | ||
|
||
## Vocabs | ||
|
||
* **iPhone** — a smartphone produced by Apple that runs the **iOS operating system**. | ||
* **iOS** — the operating system that runs all iPhones and iPads. It’s responsible for downloading and running apps, | ||
making calls, taking photos, and pretty much everything else. | ||
* **Swift** — Apple’s modern programming language. It is the language used to make apps for iOS, watchOS, MacOS, and all | ||
other Apple platforms. The language is relatively new, so new versions (with different syntax!) come out frequently. | ||
For this reason, you should search **Swift 5** (the current version) whenever searching StackOverflow or Google. | ||
* **Swift 5** — the newest version of Swift, which we’ll use in this class. | ||
* **UIKit** — Apple’s original user interface development kit, used on Apple platforms like iOS. UI development kits are | ||
how you **interact** on the code level with iOS. We won't focus on UIKit in this class, but we'll cover it briefly | ||
later in the semester. | ||
* **SwiftUI** — Apple's new user interface toolkit. It uses a declarative syntax, allowing developers to describe UI | ||
elements and behavior succinctly. SwiftUI is known for its simplicity and efficiency compared to UIKit, with live | ||
preview features in Xcode. We’ll spend most of this class learning SwiftUI development. | ||
* **Xcode** — an IDE (integrated development environment) provided by Apple. This is the iOS equivalent of Java’s | ||
Eclipse/IntelliJ editor. It allows you to write and compile Swift, and also provides a lot of niceties | ||
(autocompletion! type checking!). | ||
* **Xcode Simulator** — a full iPhone simulator built into Xcode. We’ll use this to quickly test iOS apps without | ||
needing an actual iPhone (although if you have an iPhone, you can use that too!). | ||
|
||
## Install Xcode and Simulators | ||
|
||
1. Make sure you are running **macOS Ventura 13.5 or higher.** If you are not, update your OS first. This version is | ||
required for the version of Xcode we use. | ||
2. Make sure you have at least **30-40 GB free** on the disk. This is the typical space taken up by Xcode with its dev | ||
dependencies. | ||
3. Go to the Mac App Store and install the latest version of Xcode available. If you have Xcode already, make sure it is | ||
at least updated to one of the version 15's. | ||
4. Launch Xcode and accept any permission dialogues. You may need to enter your computer password. | ||
5. When you are asked to "Select the platforms you would like to develop for," select "iOS". The others are optional for | ||
this class, and you can always download them | ||
later when needed. Again, make sure you have sufficient storage for the additional components. | ||
|
||
Here is a [video](https://www.youtube.com/watch?v=LBYj-xVvM1k) walk-through of the installation. It also covers topics | ||
including connecting your iPhone with Xcode and running apps from Xcode. App 0 only requires the steps listed above. | ||
|
||
Note: If you run into any issues throughout the installation step, make sure | ||
you've [updated your OS](https://support.apple.com/guide/mac-help/get-macos-updates-mchlpx1065/mac) and have enough | ||
storage available to download XCode. The installation takes a long time, so let it sit for at least a few hours before | ||
asking for help. | ||
|
||
If you made it this far, your environment should be set up for the semester. Next, we’ll get started with Xcode | ||
playgrounds. | ||
|
||
## Xcode Playgrounds | ||
|
||
> “Playground - noun: a place where people can play” | ||
Playgrounds are miniature testing environments for the Swift language. They allow you to quickly try out code and see | ||
results — without making a full app! Some of our tutorials will use Playgrounds. | ||
|
||
#### Do the following: | ||
|
||
- Make a new folder for this course. Make sub-folders named `tutorials` and `apps`. | ||
- Launch Xcode. | ||
- Click on File > New > Playground. | ||
- Pick "iOS" and "Blank" for the template. | ||
- Name the new playground `app0_lastname_firstname` and save it in your new `apps` folder. | ||
|
||
Great! You should now see a Playgrounds file with some boilerplate code: | ||
|
||
<img src="/~cis1951/images/playground_parts.png" alt="labeled playground parts"/> | ||
|
||
1. This is the code editor. Code goes here! | ||
2. This is a “status panel” — a feature unique to Playgrounds. When you initialize a variable, it will show you the | ||
value of that variable. This will also show you useful debugging info, like how many times each line of code is run. | ||
This is a feature of Playgrounds that we won't have when developing full apps. | ||
3. This is the **play** button to compile and run code. | ||
4. This is the output console — errors and print statements are sent here. | ||
|
||
#### Do the following: | ||
|
||
- Erase the line beginning with `var greeting = "Hello...` | ||
- Write a comment: `// App 0` | ||
- Make constants for your name, penn id (number), and favorite emoji (replace the \<...\>): | ||
|
||
```swift | ||
let name = "<YOUR NAME>" | ||
let pennId = <PENNID> | ||
let emoji = "<YOUR EMOJI>" | ||
``` | ||
|
||
- Add a line to print out your constants: | ||
|
||
```swift | ||
print("Hello World! My name is \(name) and my pennId is \(pennId) \(emoji)") | ||
``` | ||
|
||
- Click the play button to compile and run. | ||
|
||
Congrats! You just ran your first line of Swift 🎉🎉🎉 | ||
|
||
**DON’T FORGET:** [Submit `app0_lastname_firstname.playground` on Canvas](https://canvas.upenn.edu/courses/1774063/assignments/12057154) by **Monday, 1/29 @11:59 PM**. |
Oops, something went wrong.