https://pilgwon.github.io/blog/2017/09/26/RxSwift-By-Examples-1-The-Basics.html

 

예제로 시작하는 RxSwift #1 - 기초

RXSWIFT BY EXAMPLES #1 – THE BASICS.

pilgwon.github.io

필권님의 포스팅을 따라한 부분 정리하여 남깁니다.

Functional Reactive Programming - 반응형 프로그래밍을 함수형 프로그래밍 블록(filter, map, reduce 등)과 함께 사용하는 것

ReactiveX is a combination of the best ideas fromthe Observer pattern, the Iterator pattern, and functional programming

why?

  1. 테스트 하기 어려운 notification 대신에, 신호(signal)를 사용할 수 있습니다
  2. 많은 코드를 작성해야하는 delegate 대신에, 블록을 작성해서 switch와 if를 삭제할 수 있습니다.

스마트폰은 관찰이 가능(observable) 합니다. 스마트폰은 페이스북 알림, 메세지, 스냅챗 알림 등과 같이 신호(signal)를 방출 합니다. 우리는 자연적으로 스마트폰을 구독(subscribe)하고 있고, 모든 알림을 홈 스크린에서 확인할 수 있습니다. 이제 그 신호(signal) 로 무엇을 할 지 정할 수 있습니다. 우리는 관찰자 (observer) 입니다.

따라하면서 만든 깃 - https://github.com/zapping0320/RxTable

덧> debounce? vs throttle?

* debounce는 마지막 이벤트를 초기화하는 다음 이벤트가 발생하지 않으면(T)그 마지막 이벤트가 전달되는 방식

* throttle은 이벤트가 발생하면 전달?하고 T만큼 지나는 사이에 발생한 마지막 이벤트를 전달

 

by 무위자연 2020. 4. 21. 08:51

MLinkerDemoAppliedTemplateForRelease.pdf
1.20MB

MLinker라는 ios app을 만들게 된 https://github.com/zapping0320/MLinker

#1 시작은

ios app을 만들고 싶었고

회사에 모바일 개발 능력을 보여주고 제안도 해보고 싶었다.

#2 여러 고민 끝에

firebase를 공부해보고 채팅앱으로 만들기로 결정

#3 관련 스터디를 진행하고

기본적인 기능 정리와 구현을 진행했고

#4 사내 디자이너분에게 사적으로 소정의 금액과 취지를 설명해서

디자인 검수를 받았다.

디자인 검수를 받으면서 생각해보지 않은 layout 혹은 기능을 위해서 공부를 추가로 하는 긍정적인 요소가 있었고

혼자 개발하면서 보이지 않았던 불편함이나 버그도 수정할 기회도 생겼다.

#5 프로젝트 마무리는

코드 정리 및 사내 발표(20.2.18)로 마무리하였다.

진행하면서 모바일 앱 개발의 가능성도 타진해보고 요구도 해봤지만 멀었다는 반응뿐이라 아쉽지만 제안까지가 목표였으니 감내 할 수 있다.

#얻은 것

-스토리보드를 이용한 기본앱 개발에 대한 지식은 습득했음을 확인함. 디자인 시간을 받아서 처리하는 경험도 해봄-기존 ios앱 개발은 대충 개발자들끼리 맞춘게 것이 다였음(swift든, objectiveC든)

-계속 ios app이 재미 있을 것 같아서 안드로이드는 안 쳐다봐야지 하는 마음?

by 무위자연 2020. 3. 2. 09:28

관련 애플 문서 : https://developer.apple.com/documentation/foundation/userdefaults 

object c 사용 포스팅 : http://bmwe3.tistory.com/1725?category=682591 

예는 array

<저장하기>

 if var keywordList = UserDefaults.standard.array(forKey: keywordField) as? [String] {

            keywordList.insert(keyword, at: 0)

            if(keywordList.count > 5)

            {

                keywordList.remove(at: 5)

            }

            UserDefaults.standard.set(keywordList, forKey: keywordField)

        }

        else {

            var newList = [String]()

            newList.append(keyword)

            UserDefaults.standard.set(newList, forKey: keywordField)

        }


<get / 꺼내쓰기>

 return UserDefaults.standard.array(forKey: keywordField) as! [String]

by 무위자연 2019. 1. 12. 11:16

여러 개의 조건을 선택적으로 적용하는 NSPredicate를 작성하는 방법


let predicateNotebookId = NSPredicate(format: "relatedNotebookId = %@", NSNumber(value: self.selectedNoteBookId)) // basic NSPredicate

 var predicateList = [NSPredicate]()//여러 조건을 추가할 list

  predicateList.append(predicateNotebookId)


   if(self.searchText_ != "")//추가 조건 #1

   {

             let predicateSearch = NSPredicate(format: "title contains %@ OR content contains %@", self.searchText_, self.searchText_)

predicateList.append(predicateSearch)

 }

        

  if(self.button_searchByAlarm.isSelected == true)//추가 조건 #2

   {

            let predicateAlarm = NSPredicate(format: "alarmDate != nil ")

            predicateList.append(predicateAlarm)

    }

        

    let andPredicate:NSCompoundPredicate = NSCompoundPredicate(type: .and, subpredicates: predicateList)

여러 조건을 적용하여  사용한다.



by 무위자연 2019. 1. 12. 10:12
일시 : 2018.11.6

S.시작하며
-개발 세미나 참석은 처음이라 긴장도 되고 외롭기도 했는데.
-ios 개발은 원래 외로운 거더라고요~ 대부분 3명 이하의 조직?에서 개발.. 혼자도 많고
-개발도 잘하고 발표도 잘 하는 분들 많더라!! 이봉원님은 목소리까지 짱!
-계속 공부하고 계속 새로운 것을 봐야 하고 다른 사람들은 뭐하는지 보고 살아야 겠다
-뭔가 소통하고 싶었으나...말 걸...어려웠다ㅠ

-내 기준에서 주목 혹은 기록하고 싶은 것만 정리하면 다음과 같다.
A. iOS 라브 Ruby - 김은영님
ruby로 만들어진 bundler를 이용해서 개발/배포 작업에서 도움이 되는 gem을 사용한다.(사용법은 cocoapod과 동일)
*주목한 gem

1. Houston : local 환경에서 push 테스트할  있는  gem

https://github.com/nomad/houston 

2. Fastlane :  app store 업로드  심사 신청까지 해주는 gem

https://github.com/fastlane/fastlane 

가장 큰 이점은 로컬에서 심사를 위한 업로드로 40분씩  때리지 않아도 된다~


B. RIBs - 김남현님

우버에서 제안하는 크로스 프레임 워크

https://github.com/uber/RIBs/wiki 

모든 Flow를 Tree를 그린다는 관점에서 접근하는 것은 비단 모바일에서만 가능한 일은 아닐 것으로 보인다.


C. GraphQL

REST Api의 단점을 보완하고 HTTP의 특성을 잘 살려낸 API 구현 방식

차세대가 될지는 지켜봐야 하지만 장점이 많은 방식이고 이미 적용된 사례가 생겨나고 있음(GitHub)

https://graphql.org/learn/  


Z.맺으며

경품.

벌킨, 에어팟, 애플와치4!!!!....는 다 남 이야기 ㅠ


by 무위자연 2018. 11. 7. 13:51

uiactionsheet deprecated at iOS8


so we have to change uiaction sheet to uialertcontroller


<example at UIViewController>

let alertController = UIAlertController(title: "등록된 혈당측정기를 삭제하시겠습니까?".localized, message: "", preferredStyle: .alert)

        let confirmAction = UIAlertAction(title: "확인".localized, style: .default, handler: { (action) -> Void in

            //do something

        })

        let cancelAction = UIAlertAction(title: "취소".localized, style: .cancel, handler: { (action) -> Void in

            //self.tableView.setEditing(false, animated: true)

        })

        alertController.addAction(confirmAction)

        alertController.addAction(cancelAction)

        self.present(alertController, animated: true, completion: { () -> Void in

            //do something

        })


//handle event selections

func selecttypeitem(action : UIAlertAction){

        var buttonIndex:Int = 0

        for title in self.termTitles {

            if(action.title == title)

            {

                break

            }

            buttonIndex = buttonIndex + 1

        }

}


<example at UIView>

 self.present to use like below

UIApplication.shared.keyWindow?.rootViewController?.present(alert, animated: false, completion: nil)


* we cant use sender.tag

* we can use only one action type cancel! if you add multiple cancel action, it will occur exception!

by 무위자연 2017. 12. 4. 11:43



NSUserDefaults  - c#의 Setting에 가까운 것
키를 이용해서 저장
NSString *valueToSave = @"someValue";
[[NSUserDefaults standardUserDefaults] setObject:valueToSave forKey:@"preferenceName"];
[[NSUserDefaults standardUserDefaults] synchronize];
저장된 값을 확인.
NSString *savedValue = [[NSUserDefaults standardUserDefaults]
  stringForKey:@"preferenceName"];


by 무위자연 2017. 5. 19. 15:51


timezone / utc string to NSDate

ex 2017-05-15T18:49:00+0900"
dateformat은 yyyy-MM-dd'T'HH:mm:ssxxxx
xxxx가 핵심 swift와 공통


by 무위자연 2017. 5. 19. 15:50
| 1 2 |