목록iOS (106)
大器晩成
titleLabel.text = item.title.replacingOccurrences(of: "]+>|"", with: "", options: .regularExpression, range: nil)
스위프트에서 프로토콜은 일급객체이기 때문에, 타입으로 사용할 수 있습니다. * 프로토콜은 타입입니다.protocol Bird { func fly() func sit()}struct Eagle: Bird { func fly() { print("독수리가 날고있습니다.") } func sit() { print("독수리가 앉아있습니다.") } func hunt() { print("독수리가 사냥 중입니다.") } }struct Sparrow: Bird { func fly() { print("참새가 날고있습니다.") } func sit() { print("참새가 앉아있..
[서브스크립트 요구사항]get, set 키워드를 통해 읽기/쓰기 여부를 설정 (최소한의 요구사항)get 키워드 -> 최소한 읽기 서브스크립트로 구현 / 읽기, 쓰기 모두 구현 가능합니다.get/set 키워드 -> 반드시 읽기, 쓰기 모두 구현해야 합니다.protocol Numbers { subscript(idx: Int) -> Int { get }}struct Number: Numbers { // subscript(idx: Int) -> Int {// get {// return 0// }// } subscript(idx: Int) -> Int { get { return 0 } set..

iOS에서 지원해 주는 MapKit을 활용하여 특정 좌표에 Pin을 보여주는 예제입니다. import UIKitimport MapKitclass ViewController: UIViewController { private let mapView = MKMapView() override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .white layout() } private func layout() { view.addSubview(mapView) // Auto Resizng 해제 mapView..