Skip to content

Instantly share code, notes, and snippets.

View iosdevpriyank's full-sized avatar
💻
Eager to learn new things

Priyank Gandhi iosdevpriyank

💻
Eager to learn new things
View GitHub Profile
😩 Old Way (UserNotifications) 🎉 New Way (AlarmKit)
Gets muted by Focus modes Rings loud and proud!
Buried in notification center Lives in Clock app like a VIP
"Daily repeat" is... complicated Perfect recurring patterns
Feels like a cheap knockoff Feels 100% native iOS
import UIKit
enum Bread {
case plain
case multigrain
case honeyOats
case oats
}
enum Vegetable {
// Abstraction
protocol Vehicle: AnyObject {
var vehicleType: String { get set }
func start()
func stop()
}
// Interface
extension Vehicle {
var vehicleType: String = "Car"
class Car {
func carName() {
print("Unknown car")
}
}
class BMW: Car {
override func carName() {
print("BMW car")
}
func multiplication(_ a: Int, b: Int) -> Int {
return a * b
}
func multiplication(_ a: Int, b: Int, c: Int) -> Int {
return a * b * c
}
func multiplication(_ a: Int, c: Int) -> Int {
return a * c
class LoginViewController: UITableViewDelegate, UITableViewDatasource {
// LoginViewController confirm two protocols. It's look like multiple inheritance.
}
class BaseViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
}
class LoginViewController: BaseViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
// Objects and Instances
let carObject = Car(carType: "Automatic", carColor: .white)
print(carObject.carType) // Automatic
@iosdevpriyank
iosdevpriyank / Car.swift
Created May 27, 2022 18:26
Creating Class
class Car {
var carType: String?
var carColor: UIColor?
init() {}
init(_ carType: String?, carColor: UIColor?) {
self.carColor = carColor
self.carType = carType
}