프로젝트를 시작하는 경우 기능요구서를 작성하거나 주어진다면 읽고 무슨 기술을 사용할지 간략하게 생각해봅니다.
기능요구는 목적이 변경되면 수정 될 수도 있습니다. (작은 단위 → 큰 단위)
기능요구서에 의문이 가는 부분은 질문을 하는 것이 좋습니다.
API를 사용하는 경우 어떻게 사용할 지에 대해서 자세히 알아봅니다
→ 통신을 확인하기 위해서 postman 앱을 사용하거나,
터미널 curl명령어를 통해 확인해봅니다.
# "url": "https://api.github.com/users/octocat" 확인 한 후
$ curl https://api.github.com/users/sookim-1
{
"login": "sookim-1",
"id": 55218398,
"node_id": "MDQ6VXNlcjU1MjE4Mzk4",
"avatar_url": "https://avatars.githubusercontent.com/u/55218398?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/sookim-1",
"html_url": "https://github.com/sookim-1",
"followers_url": "https://api.github.com/users/sookim-1/followers",
"following_url": "https://api.github.com/users/sookim-1/following{/other_user}",
"gists_url": "https://api.github.com/users/sookim-1/gists{/gist_id}",
"starred_url": "https://api.github.com/users/sookim-1/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/sookim-1/subscriptions",
"organizations_url": "https://api.github.com/users/sookim-1/orgs",
"repos_url": "https://api.github.com/users/sookim-1/repos",
"events_url": "https://api.github.com/users/sookim-1/events{/privacy}",
"received_events_url": "https://api.github.com/users/sookim-1/received_events",
"type": "User",
"site_admin": false,
"name": "sookim",
"company": null,
"blog": "",
"location": null,
"email": null,
"hireable": null,
"bio": null,
"twitter_username": null,
"public_repos": 34,
"public_gists": 0,
"followers": 8,
"following": 13,
"created_at": "2019-09-12T01:00:30Z",
"updated_at": "2021-06-20T16:25:27Z"
}
# 없는 아이디 유저를 입력한 경우
$ curl https://api.github.com/users/vdsjvnjsnvjkneksnv
{
"message": "Not Found",
"documentation_url": "https://docs.github.com/rest/reference/users#get-a-user"
}
UI적으로 어떻게 화면에 보여야 좋을지에 대해서도 생각합니다. (사용자의 편리성, 이해가 유용할 지?)
직접 스케치 해서 화면간의 관계를 생각해봅니다.
예시
API 응답으로 받은 정보를 바탕으로 화면을 작성합니다.
Device Orientation : 기기의 방향 설정
Main.storyboard 파일 삭제
Deployment info → Main Interface탭에서 Main 삭제하고 공백으로 지정
info.plist → Application Scene Manifest → Scene Configuration → Application Session Role → Item 0 → Storyboard Name 탭을 삭제
SceneDelegate.swift에서 window 및 rootViewController 설정
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(frame: windowScene.coordinateSpace.bounds)
window?.windowScene = windowScene
window?.rootViewController = UIViewController()
window?.backgroundColor = .systemBackground
window?.makeKeyAndVisible()
}
iOS 13기준으로 AppDelegate의 UILifeCycle → SceneDelegate로 위임
간단한 이유는 멀티윈도우 기능이 생기면서 화면 한개에서 두가지 다른 동작을 동시에 해야하기 때문에 scene이라는 개념이 탄생했습니다.
iOS13이후 UILifeCycle부분은 SceneDelegate로 옮겨졌습니다.
Architecting Your App for Multiple Windows
UINavigationController - 개발자 공식문서
앱을 실행하는 동안 뷰의 계층구조를 확인하고 싶은 경우