This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol Shipping { | |
func getCost(forOrder order: Order) -> Double | |
} | |
class GroundShipping: Shipping { | |
func getCost(forOrder order: Order) -> Double { | |
if order.getTotal() > 100 { | |
return 0 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Order { | |
let lineItems: [String] | |
let shipping: String | |
func getShippingCost() -> Double { | |
if shipping == "ground" { | |
if getTotal() > 100 { | |
return 0 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
checkForUpdate() | |
} | |
private func checkForUpdate() { | |
ForceUpdateManager.shared.callback = { [unowned self] (appStoreUrl, isRequiredUpdate) -> Void in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum AppVersionComparisonResult { | |
case greater | |
case smaller | |
case equal | |
case unknown | |
} | |
class AppVersion { | |
var major: Int? | |
var minor: Int? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import FirebaseRemoteConfig | |
class ForceUpdateManager { | |
// MARK: - Static | |
static var shared: ForceUpdateManager = ForceUpdateManager() | |
var callback: ((_ appStoreUrl: String, _ isRequired: Bool) -> Void)? | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person { | |
let name: String | |
var iphone: iPhone? | |
init(name: String, iphone: iPhone?) { | |
self.name = name | |
self.iphone = iphone | |
} | |