221114 - TIL

brick·2022년 11월 14일
0

TIL

목록 보기
4/22
  • 배열에서 index 찾기
if let index = state.tasks.firstIndex(where: { $0.id == state.selectedId })     {state.tasks[index].contents = todoRelay.value
}

if, firstIndex을 사용하면 index를 찾고 바로 사용할 수 있다.

  • UiButton.Configuration
var config = UIButton.Configuration.filled()
    config.baseBackgroundColor = .systemGray4
    config.baseForegroundColor = .label
    
    config.imagePlacement = .top
    config.imagePadding = 4.0
    config.titlePadding = 4.0
    
    editButton.configuration = config
    editButton.configuration?.title = "수정"
    editButton.configuration?.image = UIImage(named: "pencil")?.withTintColor(.systemBlue, renderingMode: .alwaysOriginal)
    
    deleteButton.configuration = config
    deleteButton.configuration?.title = "삭제"
    deleteButton.configuration?.image = UIImage(named: "trashCan")?.withTintColor(.systemRed, renderingMode: .alwaysOriginal)

비슷한 버튼을 만들어 줄때 사용하면 재사용성에 좋을거 같다. 조금 더 편리하게 사용하는 방법을 생각해 봐야겠다.

참고
참고

  • half modal

참고 따라서 구현해봤다. 조만간 시간있을때 자세히 코드 공부해봐야겠다.

참고
참고

0개의 댓글