Hi, well, we made it I guess, I mostly made this blog as a means of keeping myself accountable and noting down some things along the way that I learned and picked up from this challenge.
Today was “Day 1” for my 100 Days of Swift, there was not much that was in today’s section that I did not already have a stronger grasp over coming from other languages like Java and Python.
Day One:
- Variables
- Well, behaves as you normally would expect.
- declaration stuff: {var name : datatype = value}
- Strings and Integers
- We love seeing type-safety in this household.
- We can use underscores as separators??? that’s nice (i.e: Int num = 8_000_000)
- Multi-line Strings
- Same as Python
- """ must be in a line of their own
- Neat logic with the multi-line delimiter with \ to add line breaks.
- Double and Bool
- Swift infers Double if a variable is declared with a fractional number
- Booleans are booleans
- String Interpolation (string formatting)
- Well I finally know the term for this without refering to it as printf now
- You can also use functions inside the () call (i.e: (type(of: str))
- Constants
- The normal let and var stuff.
- Type Annotations
- The bit I discovered earlier in Variables bulletpoint 2, also camelCase for Swift is convention (for things that are not types and protocols)
Also XCode having a Vim mode is fantastic, I still might try to look into incorporating Swift into my neovim workflow if it’s not too much of a hassle either.