Giter Club home page Giter Club logo

yetda2_ios's Introduction

🎁 옛다 Yetda - 선물 대신 골라드립니다

간단한 질문으로 생일 선물을 추천해 주는 서비스

매번 친구들 생일선물 챙기기, 선물고르기 너무 어렵지 않나요?
옛다와 함께 선물고민 날려버려요!

[질문을 통한 선물추천]
- 간단한 질문들에 답하고 친구에게 줄 선물을 골라보세요!
- 돈이 들지 않는 선물부터, 비싼 선물까지 가격대에 맞는 선물을 추천드려요!

Skills

platform:iOS language:Swift AppStore:Download

Dependencies

Depencency Version
Kingfisher 7.0.0
Realm 10.20.0
Firebase 8.10.0



<옛다>는 Nexters와 UPF 활동을 통해 만들어졌습니다.

💝 Nexters http://teamnexters.com

💝 UPF 2021 FW https://www.unit.center/upf


다른 저장소도 구경오세요!

💝 [(구) iOS] https://github.com/Nexters/Yetda_iOS

💝 [Android] https://github.com/Nexters/Yetda_Android


yetda2_ios's People

Contributors

tngusmiso avatar ellen-youn avatar

Stargazers

이재희 avatar 김현 avatar YounDit avatar

Watchers

 avatar

Forkers

potato03kth

yetda2_ios's Issues

질문 필터링 로직

물어볼 수 있는 질문은 어떤 것들인가요?

  • isAsked == false && 현재 tag 목록 에 해당하지 않는 질문들

응답 결과는 어떻게 저장하나요?

  • OX로 응답 시, 질문의 isAsked, isAnswered를 true로 설정
  • skip 시, 질문의 isAsked = true, isAnswered = false 로 설정

언제까지 질문하나요?

  • 필터링 된 선물이 10개 이하일 때, 응답한 질문이 3번 미만이라면 추가 질문하기
  • 응답한 질문이 6번 미만이라면 추가 질문하기
  • 그 외에는 다음 화면으로 이동하기

질문카드 뷰 UI (with 애니메이션)

  • 커스텀 카드뷰 클래스 생성
  • 카드뷰 shape (round corner, shadow) 설정
  • subview로 들어갈 label의 속성과 constraints 설정
  • 좌 / 우 / 상 스와이프 애니메이션 함수 구현

커스텀 네비게이션바

  • 구성요소 : 백버튼, 건너뛰기 (선택)
  • 백버튼 액션 붙이는 기능
  • 건너뛰기 액션 붙이는 기능�

결과화면 UI

  • URL로 이미지 받아오기
  • 또 다른 선물 버튼
  • 선물 로딩 로띠 적용

생일 입력 로직

  • 숫자 키보드
  • Month는 1~12 사이의 숫자만 입력 가능
    • 키보드 내리는 시점에 정상 범위일 시 두자리 수 포맷으로 변환
    • 키보드 내리는 시점에 범위 외 값이라면 alert
      확인 버튼 누르면 범위 미만은 01로, 초과는 12로 정정
  • Day는 Month에 따라 입력 범위가 달라짐.
    • 범위 외의 숫자 방어 로직은 Month와 동일

금액 입력 로직

  • 숫자 키보드
  • 0 ~ 5000만원 범위 외로 작성할 수 없도록 방어
  • 최소 > 최대 값으로 작성할 수 없도록 방어
  • 프로그래스바는 2차과제

성별 토글(라디오) 버튼

  • UI
  • selected / unselected 속성
  • 그룹화
  • 그룹에서 1~n개 선택 가능하도록 설정 => 현 시점에서 불필요한 확장

질문 화면 UI

  • 네비게이션 바
  • 다음버튼
  • 성별 화면
  • 생일 화면
  • 금액 화면
  • 일반 질문 화면 (질문, ox버튼, 잘모르겠어요)

RealmSwift 적용

  • SPM으로 패키지 설치 (https://tngusmiso.tistory.com/60)
  • 구조 설계 (Gift, Question, Update)
  • RealmManager 만들기
    • Update
      • 앱 실행시 Update 정보 꺼내기
      • 갱신 필요하면 서버에서 가져온 Update 정보 갱신 (리셋 후 저장)
    • Question
      • 앱 실행시 갱신 필요하면 서버에서 가져온 배열 저장 (리셋 후 저장)
      • 모든 질문 중에 랜덤으로 한 개 꺼내기
      • ISASKED = false이고 tagList not in TAG인 모든 질문 꺼내기 (tagList는 질문에 대해 X로 답한 태그들 목록. 임시저장공간
      • 진행하면서 isAsked 한개씩 true로 업데이트
      • 추천 완료 후 전체Question DB의 isAsked를 false로 초기화
    • Gift
      • 앱 실행시 갱신 필요하면 서버에서 가져온 배열 저장 (리셋 후 저장)
      • tagList not in TAGS.TAG이고, between startPrice and endPrice인 모든 gift 조회하기
    • GiftTag
      • 질문에 X로 답 할 때 마다 gift의 모든 tagList를 추가 저장 (업데이트)
      • 추천 완료 후 전체 GiftTag DB를 리셋

Firestore 연결

Firebase 콘솔 - Yetda 프로젝트

https://console.firebase.google.com/u/0/project/yetda-d4506/overview


  • [참고] Realm에 저장하는 기능은 RealmManager로 별도 챙길 예정

Cloud Firestore 인스턴스 초기화

import Firebase

FirebaseApp.configure()
let db = Firestore.firestore()

데이터 검색

컬렉션을 통째로 가져오려면

db.collection("컬렉션 이름").getDocuments() { (querySnapshot, err) in
    if let err = err {
        print("Error getting documents: \(err)")
    } else {
        for document in querySnapshot!.documents {
            print("\(document.documentID) => \(document.data())")
        }
    }
}

특정 document 하나만 가져오려면

  • document는 데이터 하나의 고유값을 의미
  • presents, question의 경우, document는 id값(숫자)이고
  • updates의 경우 document는 recent_updates 입니다.
let docRef = db.collection("컬렉션 이름").document("도큐멘트 이름")

docRef.getDocument { (document, error) in
    let result = Result {
        try document?.data(as: 클래스명.self)
    }
    switch result {
    case .success(let result):
        if let result = result {
            // result에 원하는 클래스 형태의 객체가 정상적으로 들어옴.
        } else {
            // 찾으려는 document가 없음.
        }
    case .failure(let error):
        // document 결과값을 원하는 클래스 형태로 디코딩 실패
    }
}

필드 검색으로 일치하는 document를 모두 가져오려면

db.collection("컬렉션 이름").whereField("필드명", isEqualTo: 일치데이터)
    .getDocuments() { (querySnapshot, err) in
        if let err = err {
            print("Error getting documents: \(err)")
        } else {
            for document in querySnapshot!.documents {
                print("\(document.documentID) => \(document.data())")
            }
        }
}

메인화면 UI (ver.1)

  • title label
  • main image
  • recommend button
    • 질문 화면 연결 (navigation present)
  • 선물추천기록은 2차과제

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.