iOS Notification 클릭후 앱을 실행시 만약 Badge Number 를 0으로 초기화 한다면, 기존의 읽지 않은 Notification 목록들이 전부 사라지게 된다. 이를 방지 하기 위해 Badge Number 만 0으로 초기화 시켜주고 싶다면, UIApplication.shared.applicationIconBadgeNumber = -1 으로 초기화 시켜주면 클릭한 Notification만 사라지고 나머지는 그대로 남아있게 된다.
Realm 에서 제공하는 기능중에 Primarykey 가 같으면 자동으로 데이터를 업데이트 해주는 기능이 있습니다. 이말인 즉 where 절 같은 조건을 줄 필요가 없다는 소리 입니다. 데이터를 추가하면 자동으로 업데이트가 필요한지 새로 튜플을 추가할건지 자동으로 실행 합니다. 사용 방법은 아주 간단한데, let realm = try! Realm() try? realm.write { realm.add(data, update: .modified) } update: .modified 를 추가해 주면 됩니다. 단! Model에 따로 primaryKey 가 정해져 있지 않으면 Error 를 뿜어내므로 주의 하시기 바랍니다.
defualtIfEmpty 어떠한 배출 값도 없을 때 또는 빈 프로듀서가 나타날때 Default 값을 배출한다. Code Observable.range(0, 10) .filter { it > 10 } .defaultIfEmpty(15) .subscribe{println("Receive $it")} 결과 예외 만약 필터링에 Observable.range(0, 10) .filter { it > 8 } .defaultIfEmpty(15) .subscribe{println("Receive $it")} 배출되는 값이 있을경우 .defaultIfEmpty(15) 는 출력 되지 않는다. 결과 switchIfEmpty 어떠한 배출값도 없는경우 Default Observable을 반환 할수 있다. Code Observa..
먼저 https://apps.apple.com/kr/app/realm-browser/id1007457278?mt=12 Realm Browser Realm Browser is a viewer and editor for .realm data store files. It allows developers implementing Realm in their apps to easily view and debug the contents of the .realm files their apps have created. Features: - View all of the objects in a .realm file apps.apple.com 맥용 Realm Browser 를 설치해 줍니다. 설치후 실행해 보면 아래와 같은..