본문 바로가기 메뉴 바로가기

Peppo

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

Peppo

검색하기 폼
  • 분류 전체보기 (221)
    • Story (13)
    • iOS (143)
      • Error (11)
    • 알고리즘 (43)
    • ETC (7)
    • React-Native (0)
    • CS (Computer science) (3)
  • 방명록

Swift protocol extension (1)
[Swift] Protocol(프로토콜) - protocol extension(프로토콜 확장)

확장으로 프로토콜 준수 추가 (Adding Protocol Conformance with an Extension) 프로토콜에 extension을 하게되면 기존 타입을 확장할 수 있습니다. 예제를 보면서 이해하는게 더 빠를것 같습니다. 바로가시죠 Extension으로 기본값 지정하기 // 1 protocol Walkable { } // 2 protocol Portable { func port() } // 3 extension Walkable { func walk() { print("걷습니다") } } // 4 struct Human: Walkable, Portable { func port() { print("듭니다") } } var human = Human() human.walk() // 걷습니다 huma..

iOS 2022. 8. 12. 17:36
이전 1 다음
이전 다음
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
  • Peppo's Github
TAG
  • iOS error
  • RIBs tutorial
  • Swift ModernRIBs
  • Class
  • Swift Error Handling
  • swift (programmers)
  • Swift joined
  • Swift 알고리즘
  • Swift inout
  • swift 고차함수
  • removeLast()
  • CS 네트워크
  • 2023년 회고
  • Swift final
  • swift protocol
  • swift programmers
  • Swift 내림차순
  • swift reduce
  • Swift 프로그래머스
  • Swift 프로퍼티
  • Swift Leetcode
  • Swift joined()
  • Combine: Asynchronous Programming with Swift
  • RTCCameraVideoCapturer
  • swift property
  • Swift RIBs
  • Swift
  • ios
  • Swift init
  • 원티드 프리온보딩
more
«   2025/05   »
일 월 화 수 목 금 토
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
글 보관함

Blog is powered by Tistory / Designed by Tistory

티스토리툴바