This slide deck is based on Dr. Si Chen’s slides
As you learn Swift, you may see the influence of its C and Objective-C heritage.
main.swift. Any Swift code included in the main.swift file will be executed from top to bottom.Terminal, and Swift comes with a tool called a REPL, which stands for Read, Eval, Print Loop.Terminal in Spotlight or find the application in the system Applications/Utilities folder. – Enter the Swift REPL by typing swift repl and pressing Return. – Type the command print(”Hello, world!”) and press Return to execute it.agree and press Enter
1
sudo xcodebuild -license
1
swift repl
Create a new Xcode project iOS App Next
hello wcupa Next
hello generated.
Play icon on the tool bar. hello app shown on the home screen.
Assets.xcassets/AppIcon.appiconset,Assets, select AppIcon.Inspector area, select Single Size for iOS. .png files into the boxes according to the dimension/file name.
The icon pictures will show up inside your app’s local directory.
Rerun the simulator and observe the new icon
ContentView: View struct code as follows.swift linenums="1" --8<-- "docs/csc496/lectures/codes/01-intro/button.swift"
Assets
ContentView: View struct code as follows to user-input pokemon ID
1
--8<-- "docs/csc496/lectures/codes/01-intro/images.swift"