REAL Swift – “간단한 첫번째 프로젝트 생성하기”
REAL Swift – “간단한 첫번째 프로젝트 생성하기”
November 9, 2021
xcode를 사용해서 프로젝트 생성하고 간단한 앱 만들어보기
앱스토어에서 Xcode를 설치할 수 있습니다. 시간이 좀 오래 걸리지만..

실행하면 이러한 화면이 뜰 것입니다. 새로운 프로젝트를 생성할 것이므로, Create a new Xcode project 클릭.

iOS 앱을 만들기 위해서 저렇게 선택해 주면 됩니다.

앱을 만들기 위한 사전 설정을 완료하고 next 클릭.

가장 먼저, 이러한 화면이 뜰 것입니다.

스토리보드에서 label, button 등을 추가하고 실행해 본 첫 번째 화면입니다. 깔자마자 지워버릴 것 같이 생겼습니다. 물론 기능도 없는데, 기능을 추가해보겠습니다.
간단한 기능 추가하기

어시스턴트 에디터를 활성화해준 뒤, 소스를 연결하였습니다.
//
// ViewController.swift
// firApp
//
// Created by goddessana on 2021/11/09.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var lblHello: UILabel!
@IBOutlet weak var txtName: UITextField!
@IBAction func btnSend(_ sender: UIButton) {
lblHello.text = "O+T = <3, " + txtName.text!
//lblHello의 내용에 문자열을 더하는데, txtName을 강제 언래핑하여 붙여줍니다.
//버튼을 클릭하면 "O+T = <3, " 의 내용과 txtName의 내용이 합쳐져 출력될 것입니다.
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
}
뷰 컨트롤러 소스입니다. 예상한 대로 동작할까요???

실행하면 뜨는 화면. 여기서 버튼을 눌러 봅시다.

의도하였던 대로, text area의 문구가 합쳐져서 동작하는 것을 볼 수 있습니다.
첫 번째 앱을 만들어보았는데, 최종적으로는 운동일지 어플리케이션을 만들어 보고 싶습니다.