본문 바로가기

분류 전체보기533

[iOS] Rest API 테스트 사이트 Reqres - A hosted REST-API ready to respond to your AJAX requests Native JavaScript If you've already got your own application entities, ie. "products", you can send them in the endpoint URL, like so: var xhr = new XMLHttpRequest(); xhr.open("GET", "https://reqres.in/api/products/3", true); xhr.onload = function(){ conso reqres.in Rest API를 이용해서 json 응답값을 불러오는 테스트가 필요할 때 이용할 수 있는 사이트. 일정 횟수의 요청까.. 2022. 5. 21.
[iOS Issue] constraint으로 animate 하기 전, layoutIfNeeded를 꼭 호출해야함 How to animate a UIImage constraints in Swift 4 I am making a card app and I need to make an animation so that a card would change its constraints to move to another place. How would I do this for a UIImage. stackoverflow.com UIView.animate에서 constraint을 변경 예전에 글을 올린 적이 있지만 UIView.animate 내부에서 constraint의 constant 값을 수정해서 animation을 실행할 시, layoutIfNeeded를 클로저 내부에 꼭 호출을 해야 UI가 업데이트 되면서 애니메이션이 동작한.. 2022. 5. 21.
[iOS] URLSession Apple Developer Documentation developer.apple.com URLSession URLSession은 네트워크 데이터 전송과 관련된 태스크를 처리하는 오브젝트이다. 명시된 URL을 통해 데이터를 다운로드, 혹은 업로드하는 API를 제공한다. 또한 백그라운드 상황, 즉 앱이 suspended되어있거나 하는 상황에서 background download를 할 수 있도록 API를 제공한다. URLSessionDelegate, URLSessionTaskDelegate을 이용하여 인증을 지원하거나, redirection, task completion과 같은 작업을 처리할 수 있다. App은 여러 개의 URLSession 인스턴스를 생성해서 관련된 여러 개의 data-transfer 태스.. 2022. 5. 16.
[Swift] closure에서 self를 써야하는 이유 closure에서는 왜 self를 사용해야 할까? closure에서는 왜 self를 사용해야 할까? class에서 closure를 사용할 때 closure 안에서 객체의 변수 또는 함수에 접근할 때 self를 붙여서 사용을 해야합니다. class안에서는 self... eastjohntech.blogspot.com closure에서 self를 써야하는 이유 closure에서는 아래 2개의 이유 때문에 closure안에서 사용할 객체를 정의하는 capture list를 지원한다. 순환참조 문제 해결 객체의 복사 이 때 self는 closure안에서 사용되기 위해 암묵적으로 이미 capture list에 추가되어 있는 상태이기 때문에 closure에서는 바로 instance 객체에 접근을 할 수가 없고 캡처된.. 2022. 5. 16.