// 가벼운 물리적 충돌을 묘사
let impactLight = UIImpactFeedbackGenerator(style: .light)
impactLight.impactOccurred()
// 무거운 물리적 충돌을 묘사
let impactHeavy = UIImpactFeedbackGenerator(style: .heavy)
impactHeavy.impactOccurred()
// 어떤 요소를 선택하거나 했을 때 사용
let selection = UISelectionFeedbackGenerator()
selection.selectionChanged()
//notification 은 한 번만 선언해도 됨!
let noti = UINotificationFeedbackGenerator()
//액션의 결과에 따라 각각 성공, 에러, 주의를 위한 진동
noti.notificationOccurred(.success) // 성공
noti.notificationOccurred(.error) // 에러
noti.notificationOccurred(.warning) // 주의
UIView - 게임 화면으로 터치와 연결되는 view
//터치 시작
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
}
//터치 이동
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
}
//터치 끝
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
}
//터치가 비정상적인 이유로 끝남
override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {
}
UIView.animate(withDuration: 5) { // 5는 애니메이션이 움직일 시간 길이입니다.
// 애니메이션이 끝난 후 보였으면 하는 결과물 블록
view.frame.height = 100
}
Firebase 설정
GoogleService-Info.plist 다운로드 > 프로젝트에 드래그 앤 드롭 > Copy items if needed
CocoaPods 설치
sudo gem install cocoapods
프로젝트 폴더로 이동 > pod init > oepn Podfile > pod 'Firebase/Analytics' 추가 및 저장 > pod install --repo-update
FingerGame.xcworkspace로 열기
AppDelegate.Swift
import UIKit
import Firebase // 추가
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
FirebaseApp.configure() // 추가
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
CocoaPods 업데이트
pod 'Firebase/AdMob'
AppDelegate.swift 수정
import UIKit
import Firebase
import GoogleMobileAds // 추가
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
FirebaseApp.configure() // 추가
GADMobileAds.sharedInstance().start(completionHandler: nil) //추가
return true
}
...
Info.plist 에 추가 (Open As > Source Code)
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-3940256099942544~1458002511</string>
<key>SKAdNetworkItems</key>
<array>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>cstr6suwn9.skadnetwork</string>
</dict>
</array>
<key>NSUserTrackingUsageDescription</key>
<string>This identifier will be used to deliver personalized ads to you.</string>
광고 준비하기
import UIKit
import Firebase
import GoogleMobileAds
import AppTrackingTransparency
import AdSupport
func requestIDFA() {
ATTrackingManager.requestTrackingAuthorization(completionHandler: { status in
let request = GADRequest()
GADInterstitialAdBeta.load(withAdUnitID: "ca-app-pub-3940256099942544/4411468910",
request: request) { (ad, error) in
if error != nil {
return
}
self.interstitial = ad
}
})
}
개발자 등록 필요 > 1 년에 99 달러 결제
Apple의 App Store 심사 지침
[ 출시 과정 ]
1. App Icon 넣기
2. Display Name 설정
3. Product 메뉴 > Archive
4. Organizer > Distribute App > 제출
5. 접속 후 + 버튼을 눌러 신규 앱 작성
6. App Store에 앱의 설명과 스크린샷을 자세히 추가 - 스크린샷 사양
7. 빌드 선택 및 추가
8. 저장 후 제출 > 심사 기다리기!