본문 바로가기

FE 공부20

변수와 자료형 2주차 Swift 문법 스터디 변수와 자료형 변수는 var 상수는 let 변수는 수정이 가능하며, 상수는 수정이 불가능하다. var 변수이름 : Int = 1// 변수 선언 let myConstant:Int = 2// 상수 선언 기본 자료형 Swift의 기본 내장 자료형은 아래와 같다. 정수형 : Int(음수 양수 가능), UInt(음수 불가) 실수형 : Float(소숫점 6자리까지), Double(소숫점 15자리까지 정확성) 참 거짓: Boolean _ true false 문자 : Character 문자열 : String 이들의 사용법은 기본적으로 위의 변수/상수 선언시 처럼 선언한다. swift에서는 서로 다른 자료형 저장 불가 원하면 double(a) + b or a + Int(b) 형태로 계산 산.. 2023. 3. 11.
Swift - TableView _ Edit Mode 영상과 같이 사용자가 셀을 삭제, 추가, 순서 변경 등 편집할 수 있는 모드 EditButton 현재 편집 범위에 대한 편집 모드를 설정하는 버튼 - 동영상 속 '편집' 버튼 일반적으로 List와 함께 사용 List는 또 ForEach와 같이 사용하는데 (정적 + 동적 콘텐츠 조합), 이 ForEach에 onDelete {}, onMove {}를 추가하여 적용 *ForEach란? collection형태의 데이터들에 접근하는 구조체 >> List처럼 id로 식별할 수 있는 데이터를 받아서 동적으로 뷰를 생성하는 역할 onDelete / onMove .onDelete(perform: ) _ 삭제 할때 사용 .onMove(perform: ) _ 순서 변경 시 사용 struct ContentView: View .. 2022. 11. 29.
Swift - TableView _ Managing Selection Handling row selection in a table view Detect when a user taps a table view cell so your app can take the next indicated action. : 테이블뷰 row가 탭되면 화면에서 action을 취함(체크 마킹 등) Configure row selection behavior selection 설정에서 No Selection / Single Selection / Multiple Selection 지정 가능 var allowsSelection: Bool { get set } In macOS, when the value of.. 2022. 11. 29.
Swift - TableView Section Use header and footer views as visual markers for the beginning and end of sections. Header and footer views are optional, and you can customize them as much or as little as you want. : header와 footer는 section의 시작과 끝의 시각적으로 보여줄 때 사용 section의 구성 >> Header + Cell(여러개 가능) + Footer // header와 footer의 declaration // Create a standard header that includes the returned text. override func tableView(_ t.. 2022. 11. 22.