- Today
- Total
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
- 시각화
- 딥러닝
- barplot
- 명령어
- SQL
- trunc
- decode
- ios
- substr
- ReLU
- Upper
- deeplearning
- grep
- cocoapods
- rxswift
- Observable
- Linux
- Optional
- struct
- SWIFT
- delegate
- sigmoid
- scheduledTimer
- 연산자
- Python
- MVC
- r
- NVL
- tapply
- swiftUI
목록SWIFT (37)
iOS 개발 기록 블로그
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/bulhTw/btrHaX77JIO/8vpgGXGkYqEXLc7hjWt1ik/img.png)
우선 스토리보드를 보면 첫 화면에 번개 이모지와 FlashChat이라는 타이틀 텍스트가 있다. 이 텍스트를 타이핑 하듯이 보여지는 Swift의 Loop를 만들어본다. WelcomeViewController.swift importUIKit class WelcomeViewController: UIViewController { @IBOutlet weak var titleLabel: UILabel! override func viewDidLoad() { super.viewDidLoad() let fruitBasket = ["Apple", "Banana", "Orange"] for fruit in fruitBasket { print(fruit) } } } 여기서 for loop 예시를 하나 만들어놨다. 앱을 실행해..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/cGbT7c/btrHafVrqqK/55k0l8Y94nWgNOm7e3n201/img.png)
위 이미지를 보면 Email과 Password 적는 TextFeild의 이미지가 custom 이미지가 적용된 것이다. 그림자가 져 있는 것을 볼 수 있다. Assets.xcassets에 들어가보면 있다. 경고 메시지 아래 3가지 에러가 보인다. 이를 해결하기 위해 파란색 스토리보드 화면을 클릭하고 오른쪽에 'Is initial View Controller' 체크박스를 체크해준다. 그리고 파란색 스토리보드 왼쪽에 붙어있는 '->' 이 모양 화살표를 드래그해서 첫번째 화면에 갖다 붙여준다. Register 스토리보드와 Log in 스토리보드를 Chat View Scene과 각각 연결해주는 Segue를 만들어준다. 그리고 첫화면에서 Register과 Log in 버튼을 각각 control키 + 드래그앤드롭으로..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/b4jUR0/btrF4FnTmII/Hhg3NkcrzJaqkXb2sd6961/img.png)
지난 글들에서 익혔던 Networking과 API를 숙달하기 위해 비트코인 가격 조회하는 어플리케이션을 만들어볼 것이다. 지난 글 링크 iOS (Swift) GPS 받고 위도, 경도 받아서 날씨 API 데이터 받기 CoreLocation를 활용하여 위치 데이터를 받아볼 것이다. 먼저 해당 라이브러리를 import 해줘야 한다. import UIKit import CoreLocation class WeatherViewController: UIViewController { .. crazydeer.tistory.com URLSession을 사용하는 방법, HTTP Requests, JSON Parsing을 위한 JSON Decoder을 복습해볼 것이다. 흔히 거래되는 각국의 통화 별 비트코인의 가격을 조회해본..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/0HgYg/btrFXWYIu3Q/8rBG5tRDWDoVusRSu5hOw0/img.png)
CoreLocation를 활용하여 위치 데이터를 받아볼 것이다. 먼저 해당 라이브러리를 import 해줘야 한다. import UIKit import CoreLocation class WeatherViewController: UIViewController { @IBOutlet weak var conditionImageView: UIImageView! @IBOutlet weak var temperatureLabel: UILabel! @IBOutlet weak var cityLabel: UILabel! @IBOutlet weak var searchTextField: UITextField! var weatherManager = WeatherManager() let locationManager = CLLocat..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/ccjOVU/btrFT066RmS/Tquvyq5ftEIsFWd5yi0C71/img.png)
이번 글에서는 MARK: - 키워드이 무엇인지, 코드 스니핏 (Code Snippet)이 무엇인지, 새로운 코드 스니핏을 생성하는 방법에 대해 알아보자. 우선 MARK: - 키워드에 대해서 보자 MARK: - 우선 사용하는 방법은 아래와 같다. 이렇게 쓰게 되면 스크립트 상에서도 선으로 섹션이 구분되어진다. 아래 버튼을 클릭하면 아래와 같이 섹션이 구분되고 클릭하면 스크립트 중에 해당하는 부분으로 바로 가게 된다. Code Snippet, 코드 스니핏 이미지로 한번에 설명하면 다음과 같다. 왼쪽에 아이콘 중 { } 이렇게 생긴 아이콘이 바로 코니 스니핏이다. 이걸 선택하면 아시다시피 다음과 같이 된다. 손쉽고 빠르게 코딩할 수 있도록 미리 만들어놓은 틀이라고 보면 된다. Create Code Snippe..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/Y6vt9/btrFSXWK2qC/lw8Mm5xdxLuhUQq7NyxIFk/img.png)
여러가지 예시와 함께 Swift의 extension에 대해 알아보자. 지하철의 노선과 역이 계속 추가되는 것처럼 일반적으로 앱도 계속해서 기능들이 덧붙여져서 확장한다. Extensions — The Swift Programming Language (Swift 5.7) Extensions Extensions add new functionality to an existing class, structure, enumeration, or protocol type. This includes the ability to extend types for which you don’t have access to the original source code (known as retroactive modeling). Exten..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/bAkgFr/btrFyJSGDfH/km0v4cxAbaXw4ASrbo10IK/img.png)
iOS (Swift) JSON 디코딩(Decoding) func performRequest(urlString: String) { //1. Create a URL if let url = URL(string: urlString) { //2. Create a URLSession let session = URLSession(configuration: .default) //3. Giv.. crazydeer.tistory.com 지난 글에 이어 JSON을 정리하면서 MVC 디자인 패턴으로 바꾸고 그 과정에서 Computed Properties도 이해해보자. OpenWeatherAPI 문서가 제공하는 json 예시다. 여기에 id는 날씨 상태를 말하는데 이에 따라 아이콘이 변화하도록 해볼 것이다. Weather co..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/thMxZ/btrFAis2Vao/VLJ11Upg3faarovH04Pjo1/img.png)
func performRequest(urlString: String) { //1. Create a URL if let url = URL(string: urlString) { //2. Create a URLSession let session = URLSession(configuration: .default) //3. Give URLSession a task let task = session.dataTask(with: url) { data, response, error in if error != nil { print(error!) return// 에러가 있으면 스톱 } if let safeData = data { // safeData를 String 형태로 변환 } } //4. Start the task ta..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/cONvf1/btrFoOGgv6V/kuM8MTKuhEz5x2RqJ1wjo1/img.png)
일반적인 함수의 형태는 아래와 같다. func functionName (param1: dataType, param2: dataType) -> dataType { return output } 특정 데이터가 입력되어 함수를 통과하면 데이터가 출력된다. 이 입력된 데이터들을 또 다른 함수를 통과하도록 할 수 있다. import UIKit import Foundation func calculator(n1: Int, n2: Int, operation: (Int, Int) -> Int) -> Int{ return operation(n1, n2) } func add(n1: Int, n2: Int) -> Int{ return n1 + n2 } print(calculator(n1: 2, n2: 3, operation: ..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/7anxK/btrFkZBIGUW/KnHLmqiUucnoWJtz2KWDlK/img.png)
오픈 API를 사용하여 데이터를 받는 것을 Networking이라고 한다. 우리의 APP은 API를 통해 Web Server에 데이터를 요청한다. 우리가 필요한 데이터를 쿼리(Query)를 통해 요청(Request)한다. 웹 서버는 이 쿼리를 해석하고 필요로 하는 데이터를 보내준다. 이를 Response라고 한다. 이러한 일련의 프로세스를 'Networking'이라고 한다. Networking의 단계 Create a URL Create a URLSession Give URLSession a task Start the task WeatherManager.swift 파일 struct WeatherManager { let weatherURL = "https://api.openweathermap.org/data..