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 ViewModelBinding { | |
associatedtype Key | |
associatedtype Data | |
func updateNotify(changed: @escaping (Key, Data)->()) | |
} | |
class ForecastImageViewModel : ViewModelBinding { | |
typealias Key = [UIImage]? | |
typealias Data = (duration: Double, firstImage: UIImage?) | |
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 UIKit | |
import OctoKit | |
import AuthenticationServices | |
extension URL { | |
/// Returns a new URL by adding the query items, or nil if the URL doesn't support it. | |
/// URL must conform to RFC 3986. | |
func appending(_ queryItems: [URLQueryItem]) -> URL? { | |
guard var urlComponents = URLComponents(url: self, resolvingAgainstBaseURL: true) else { | |
// URL is not conforming to RFC 3986 (maybe it is only conforming to RFC 1808, RFC 1738, and RFC 2732) |
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
// | |
// archiver.swift | |
// | |
// Created by JK on 2020/02/27. | |
// Copyright © 2020 codesquad. All rights reserved. | |
// | |
import Foundation | |
class NBeverage : NSObject, NSCoding, Codable { |
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
// | |
// EchoServer.swift | |
// CS16 | |
// | |
// Created by JK on 2020/01/14. | |
// Copyright © 2020 codesquad. All rights reserved. | |
// | |
import Foundation | |
import Network |
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 InputView { | |
enum Prompt : String { | |
case height = "> 사다리 높이를 입력해주세요.\n> " | |
case names = "> 참여할 사람 이름을 입력하세요.\n> " | |
} | |
static private func read(with prompt: Prompt) -> String { | |
print(prompt.rawValue) | |
let value = readLine() ?? "" | |
return value |
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 User { | |
var username: String | |
private var age : Int = 1 | |
init(username : String) { | |
self.username = username | |
} | |
} |
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 | |
// SideView | |
// | |
// Created by JK on 2019/11/11. | |
// Copyright © 2019 codesquad. 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
#import <Carbon/Carbon.h> | |
#import <dlfcn.h> | |
/* | |
* 컴파일 명령 : gcc process.c -framework CoreServices | |
*/ | |
CFArrayRef CopyLaunchedApplicationsInFrontToBackOrder(void) | |
{ | |
CFArrayRef (*_LSCopyApplicationArrayInFrontToBackOrder)(uint32_t sessionID) = NULL; | |
void (*_LSASNExtractHighAndLowParts)(void const* asn, UInt32* psnHigh, UInt32* psnLow) = NULL; |
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 FizzBuzz { | |
func makeIf(with value: Int) -> String { | |
guard value > 0 else { return "" } | |
if value % 15 == 0 { | |
return "fizzbuzz" | |
} | |
else if value % 3 == 0 { | |
return "fizz" | |
} | |
else if value % 5 == 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 Animal : Codable { | |
var type : String { | |
return "animal" | |
} | |
} | |
class Dog : Animal { | |
override var type : String { | |
return "dog" | |
} |