Skip to content

Instantly share code, notes, and snippets.

View adriatikgashi's full-sized avatar

Adriatik Gashi adriatikgashi

View GitHub Profile
protocol Shipping {
func getCost(forOrder order: Order) -> Double
}
class GroundShipping: Shipping {
func getCost(forOrder order: Order) -> Double {
if order.getTotal() > 100 {
return 0
}
struct Order {
let lineItems: [String]
let shipping: String
func getShippingCost() -> Double {
if shipping == "ground" {
if getTotal() > 100 {
return 0
}
class MainViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
checkForUpdate()
}
private func checkForUpdate() {
ForceUpdateManager.shared.callback = { [unowned self] (appStoreUrl, isRequiredUpdate) -> Void in
enum AppVersionComparisonResult {
case greater
case smaller
case equal
case unknown
}
class AppVersion {
var major: Int?
var minor: Int?
import Foundation
import FirebaseRemoteConfig
class ForceUpdateManager {
// MARK: - Static
static var shared: ForceUpdateManager = ForceUpdateManager()
var callback: ((_ appStoreUrl: String, _ isRequired: Bool) -> Void)?
class Person {
let name: String
var iphone: iPhone?
init(name: String, iphone: iPhone?) {
self.name = name
self.iphone = iphone
}