[iOS] cell identifier 오타 안나게 하기(클래스이름.self)

RudinP·2024년 3월 5일
0

Study

목록 보기
186/227

String(describing:)

let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: EventTableViewCell.self), for: indexPath) as! EventTableViewCell
  • String(describing: 셀클래스이름.self)를 하면 오타를 안나게 할 수 있다.
    • 자동완성이 지원되기 때문.
  • 다만, 셀 클래스의 이름과 identifier을 다르게 설정했을 시 얄짤없이 직접 입력해야한다.
  • String(describing: 클래스이름.self)는 클래스 이름 자체를 String으로 리턴해주는 메소드이다.
profile
곰을 좋아합니다. <a href = "https://github.com/RudinP">github</a>

0개의 댓글