Giter Club home page Giter Club logo

dotori-market's People

Contributors

forestjae avatar jager-yoo avatar yagom avatar yeahg-dev avatar

Stargazers

 avatar  avatar

Watchers

 avatar

dotori-market's Issues

`MY DOTORI` 메뉴, 화면 구현

유저 등록 ProductID - Firebase 연동 구현

  • 상풍등록 및 삭제시 Firebase의 사용자 계정에 productID 저장 구현

MY DOTORI 뷰모델 구현

  • Firebase로부터 등록 productID 받아서 openMarketAPI에 Product�Info요청 --> 리스트에 바인딩
  • productCell 탭시 ProductDetailView 전환 구현
  • ProductDetailView에서 수정 , 삭제 구현 + Firebase의 등록 ProdcutID도 함께 업데이트

MY DOTORI 뷰 구현

  • 테이블뷰 구현

`상품 리스트 화면` MVVM 리팩터링

상품 리스트 화면 MVVM 리팩터링

  • rxSwift, rxCocoa 패키지 추가

ProductTableViewController

  • ProdutViewModel 구현
  • ProductListViewModel 구현
  • bindUI 구현

ProjectCollectionViewController ViewModel 구현

  • ProdutCollectionViewModel 구현
  • ProductColellectionViewModel 구현
  • bindUI 구현

`LIKE` 메뉴, 뷰 구현

LIKE 뷰 모델, 기능 구현

  • ProductDetailView에 ❤️ 버튼 추가
  • Firebase에 좋아요한 productID 저장 구현
  • Firebase로부터 isLike데이터 다운로딩 및 뷰 바인딩 구현

LIKE 뷰 구현

  • 테이블뷰 구현
  • 테이블뷰 셀 터치시 ProductDetail뷰로 전환 구현

Realm accessed from incorrect thread.

문제 상황

Realm 인스턴스, object들을 단일 스레드에서만 동작하게 하기위해, Custom Serial Queue를 생성, DispatchQueueRealm에서만 작업이 진행되도록 스케줄링 했다.

final class RealmStorage {
    
    static var defaultRealm: Realm!
    static var DispatchQueueRealm: DispatchQueue!
    
   // didFinishWithLaunchingOption에서 호출
    static func configureDefaultRealm() {
        DispatchQueueRealm = DispatchQueue.init(label: "realm")
        
        DispatchQueueRealm.async {
            RealmStorage.defaultRealm = try? Realm()
        }
    }
    
}

struct MarketFavoriteProductRepository: FavoriteProductRepository {
    
    private let realm = RealmStorage.defaultRealm!
    private let dispatchQueue = RealmStorage.DispatchQueueRealm!
  
   ...

    func fetchFavoriteProductIDs() -> Observable<[Int]> {
        let observable = Observable<[Int]>.create{ observer in
            dispatchQueue.async {
                let products = realm.objects(LikeProduct.self)
                let favoriteProducts = Array(products.filter("isLike == YES"))
                    .map{$0.toDomain()}
                    .compactMap{ $0.id }
                    .map{ Int($0) }
                observer.onNext(favoriteProducts)
            }
            return Disposables.create()
        }
        return observable
    }

    ...
}

Realm이 올바르지 않은 스레드에서 접근되었다는 오류를 뱉었다.

*** Terminating app due to uncaught exception 'RLMException', reason: 'Realm accessed from incorrect thread.'
terminating with uncaught exception of type NSException

image

해결

warning Non-frozen RLMRealm instances are thread-confined and cannot be shared across threads or dispatch queues. Trying to do so will cause an exception to be thrown. You must obtain an instance of RLMRealm on each thread or queue you want to interact with the Realm on. Realms can be confined to a dispatch queue rather than the thread they are opened on by explicitly passing in the queue when obtaining the RLMRealm instance. If this is not done, trying to use the same instance in multiple blocks dispatch to the same queue may fail as queues are not always run on the same thread.

동일 인스턴스를 여러 블럭내에서 동일 큐에 디스패치시키면, 큐는 항상 동일 스레드에서 실행되지 않기 때문에 실패할 수 있다고한다.

이 같은 상황이라고 판단해서, DispatchQueue(label: "realm")을 사용하지 않고 MainQueue를 사용했다.

    static func configureDefaultRealm() {
        DispatchQueueRealm = DispatchQueue.main
        RealmStorage.defaultRealm = try? Realm()
    }

스레드 오류 없이 성공했다. 하지만 메인큐는 최대한 UI작업만 처리되도록하는 것이 좋다고 생각해 커스텀 큐가 특정 스레드에서만 동작하도록 하는 방법을 알아보아야겠다.

`상품 정보 수정 화면` 구현

상품 정보 수정 화면 구현

등록 상품의 정보를 수정하는 기능

  • 수정 요청 정보가 유효한 정보인지 검증
  • 수정시 판매자 비밀번호를 요청
  • 유효한 정보 & 비밀번호 일치시 수정 수행

✅ To do

  • ImagePicker를 사용한 대표사진 수정 기능
  • 입력형식에 알맞는 키보드 구현
  • 수정 요청 정보 유효성 검증
  • 상품 수정 request 구현

탭 메뉴 UI 수정

탭 메뉴 UI 수정

각 기능을 Tab Menu로 분리

  • SHOP : 상품 보기 (리스트뷰, 그리드뷰)
  • MY DOTORI : 상품 수정 및 삭제
  • LIKE : 좋아요한 상품 리스트
  • MY PAGE : 로그인 및 회원정보 설정

기존 기능 탭 메뉴 연결

  • 상품 리스트 화면 (ProjectTableViewController,ProjectCollectionViewController) 를 SHOP 메뉴에 연결

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.