Wednesday, Sep 12, 2018 --> EEEE, MMM d, yyyy
09/12/2018 --> MM/dd/yyyy
09-12-2018 14:11 --> MM-dd-yyyy HH:mm
Sep 12, 2:11 PM --> MMM d, h:mm a
September 2018 --> MMMM yyyy
Sep 12, 2018 --> MMM d, yyyy
Wed, 12 Sep 2018 14:11:54 +0000 --> E, d MMM yyyy HH:mm:ss Z
2018-09-12T14:11:54+0000 --> yyyy-MM-dd'T'HH:mm:ssZ
12.09.18 --> dd.MM.yy
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
//연결 재시도? 하면서 오류나는 부분입니다. | |
/* | |
* We will first check if we are already connected to our counterpart | |
* Otherwise, scan for peripherals - specifically for our service's 128bit CBUUID | |
*/ | |
private func retrievePeripheral() { | |
print("[hoonki] test=\(TransferService.serviceUUID)") | |
//cleanup() | |
let connectedPeripherals: [CBPeripheral] = (centralManager.retrieveConnectedPeripherals(withServices: [TransferService.serviceUUID])) |
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 RxSwift | |
extension Reactive where Base: UIButton { | |
var longPress: Observable<Int> { | |
return controlEvent(.touchDown) | |
.flatMapLatest { _ in | |
Observable.timer(.milliseconds(500), scheduler: MainScheduler.instance) | |
.takeUntil(self.controlEvent(.touchUpInside)) | |
} | |
} |
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
// | |
// OneTimeCodeTextField.swift | |
// | |
// Created by 홍경표 on 2021/05/13. | |
// | |
import UIKit | |
final class OneTimeCodeTextField: UITextField { |
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
extension String { | |
func toMoneyFormat() -> String { | |
guard let amount = Int(self) else { return self } | |
let formatter = NumberFormatter() | |
formatter.numberStyle = .decimal | |
return formatter.string(for: amount) ?? self | |
} |
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
// | |
// Cell+Reusable.swift | |
// | |
// Created by 홍경표 on 2021/04/12. | |
// | |
import UIKit | |
protocol Reusable { | |
static var reuseIdentifier: String { get } |
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
extension Encodable { | |
subscript(key: String) -> Any? { | |
return dictionary[key] | |
} | |
var dictionary: [String: Any] { | |
let dict: [String: Any]? = try? JSONSerialization.jsonObject(with: JSONEncoder().encode(self)) as? [String: Any] | |
return dict ?? [:] | |
} |
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
// | |
// CodableInheritanceExample.swift | |
// | |
// Created by 홍경표 on 2021/05/28. | |
// | |
class BaseResponse: Codable { | |
var retCode: Int = 0 | |
private enum CodingKeys: String, CodingKey { |
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
// | |
// Logger.swift | |
// | |
// Created by 홍경표 on 2021/05/28. | |
// | |
import Foundation | |
final class Logger { | |
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
// | |
// NSAttributedString+withPrefixImage.swift | |
// | |
// Created by 홍경표 on 2021/05/31. | |
// | |
import UIKit.UIImage | |
extension NSAttributedString { | |
OlderNewer