Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/heyjaywilson/100daysofswiftui
100 Days of SwiftUI log
https://github.com/heyjaywilson/100daysofswiftui
Last synced: 11 days ago
JSON representation
100 Days of SwiftUI log
- Host: GitHub
- URL: https://github.com/heyjaywilson/100daysofswiftui
- Owner: heyjaywilson
- Created: 2022-02-08T01:45:02.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-16T11:55:21.000Z (over 2 years ago)
- Last Synced: 2024-05-02T01:05:35.836Z (7 months ago)
- Language: Swift
- Size: 13.7 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 100DaysOfSwiftUI
100 Days of SwiftUI log## Table of Contents
- [Day 1: variables, constants, strings, and numbers](#day-1)
## Day 1
Variables store values and can be changed multiple times
`var` is used to declare variablesConstants store values and cannot be changed after the initial assignment
`let` is used to declare constantsStrings are enclosed with `"`
Example of multiline string```swift
let multiLineString = """
Here is a multi line string
Notice the opening triple \" and
the closing triple \"
"""
```Useful functions for Strings
`.hasPrefix()` checks to see if the string begins with the passed in arg
`.hasSuffix()` checks to see if the string ends with the passed in argTo use variables inside strings use `\(variable name)`
```swift
let age = 32
let taylorSwift = "Taylor Swift is \(age)"
```Whole numbers are called `Ints`
To separte whole numbers consider using `_` these will be ignored in Swift so
`100_000_000` = `100000000`
If using shortcut operators you must declare and initialize before using them.
```swift
var doubleCount += 5 // this will throw an error
``````swift
var doubleCount = 0
doubleCount += 5 // this will not fail
```Decimal Numbers are called Doubles
number types can be changed to another number type but a string cannot change into a number type.