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
func makePascalTriangle(numOfRows: Int) -> ([[Int]]) { | |
func getNextRow(_ arr: [Int]) -> [Int] { | |
let a = zip([0]+arr, arr+[0]) | |
return a.map({ | |
(e: (Int, Int)) -> Int in | |
e.0 + e.1 | |
}) | |
} | |
func helper(_ countDown: Int, results: [[Int]]) -> (Int, [[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
var x : Int? = 10 | |
//arguments | |
func foo(arg : Int?) { | |
guard let arg = arg else { | |
return | |
} | |
print(arg) | |
} | |
foo(arg:x) |
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
// | |
// main.swift | |
// HelloOperator | |
// | |
// Created by JK on 09/04/2018. | |
// Copyright © 2018 JK. All rights reserved. | |
// | |
import Foundation |
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
// | |
// MyCustomView.swift | |
// CustomView | |
// | |
// Created by JK on 12/04/2018. | |
// Copyright © 2018 JK. All rights reserved. | |
// | |
import UIKit |
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
// | |
// ViewController.swift | |
// HelloAnimation | |
// | |
// Created by JK on 19/04/2018. | |
// Copyright © 2018 JK. All rights reserved. | |
// | |
import UIKit |
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 Entity { | |
var name : String = "" | |
init(name : String) { | |
self.name = name | |
} | |
} | |
class Order { | |
private (set) var id = UUID() | |
private (set) var date = Date() |
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 Customer : | |
Entity, | |
AggregateProtocol | |
{ | |
private (set) var id : UUID | |
private (set) var email : String | |
private var orders : Array<Order> | |
//...중간생략... | |
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 Product { | |
private var id = UUID() | |
} | |
class CustomOrderRequest { | |
private (set) var products = [Product]() | |
} | |
protocol OrderCommand { |
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 CustomerRepositoryProtocol { | |
} | |
protocol ProductRepositoryProtocol { | |
} | |
struct ConversionRate { | |
var fromCurrency : String |
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 CustomerOrderController { | |
private (set) var orderService : OrderService | |
init(service: OrderService) { | |
self.orderService = service | |
} | |
} |
OlderNewer