4. Post 모델 구현
struct Post: Codable {
let createdDate: Timestamp?
let nickName: String
let positionSearch: String // "구인" 또는 "구직"
let position: String // 직무
let availableTime: String // 가능 시간
let techstack: [String] // 기술 스택 배열
let urgencyLevel: String // 시급성
let specificity: String // 아이디어상황
let recruits: String // 모집 인원
let meeting: String // 협업방식
let experience: String // 경험
let title: String // 제목
let detail: String // 상세 내용
}
5. 게시글 작성 및 Firestore 저장
let data = [
"createdDate": FieldValue.serverTimestamp(),
"nickName": nickName,
"positionSearch": positionSearch,
// ... 기타 필드
]
db.collection("posts").addDocument(data: data)
6. 게시글 표시 테스트 뷰 구현
Firestore 데이터 가져오기
db.collection("posts").limit(to: 1).getDocuments { [weak self] snapshot, error in
guard let document = snapshot?.documents.first else { return }
let data = document.data()
// Post 객체로 변환
}
https://hello-developer.tistory.com/53
[Swift] Cloud Firestore(2) 실습해보기
지난 포스팅에서는 간단하게 Cloud Firestore에 데이터가 어떻게 저장되는지 전체적인 구조를 살펴보았는데요~!! 데이터 구조를 잘 모르면 먼저 구조부터 확실하게 알고 실습을 시작하는게 좋습니
hello-developer.tistory.com
'내일배움캠프 iOS' 카테고리의 다른 글
iOS) TIL # 68 실전프로젝트 - 4 (0) | 2025.01.24 |
---|---|
iOS) TIL # 66 실전프로젝트 -2 (0) | 2025.01.22 |
iOS) TIL # 65 실전프로젝트 -1 (0) | 2025.01.22 |
iOS) TIL # 63 실전프로젝트 기획 (0) | 2025.01.22 |
iOS) TIL # 62 실전프로젝트 발제 (0) | 2025.01.22 |