250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- iPhone
- jQuery
- MAC
- button
- php
- 애니메이션
- javascript
- SWIFT
- HTML
- html5
- 프론트엔드
- ipad
- 백엔드
- Animation
- 풀스택
- effect
- react
- xcode
- 개발자
- front-end
- image
- css3
- 비전공 개발자
- CSS
- hover
- keyframes
- iOS 개발자
- IOS
- 비전공자
- 자바스크립트
Archives
- Today
- Total
비전공자 개발일기
Xylophone 본문
728x90
SMALL
프로그래밍에 문제가 있거나 코드가 특정 작업을 수행하도록 하는 경우
1. 구글
2. StackOverFlow로 이동
3. 찾은 코드 구현
4. 공식 문서에서 코드의 의미 찾기
5. 필요에 맞게 커스텀
stackoverflow 검색
앱에서 내가 하고 싶은 것 + 프로그래밍 언어 + 출처
ex) play sound Swift StackOverFlow
import UIKit
import AVFoundation
class ViewController: UIViewController {
var player: AVAudioPlayer?
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func btnPress(_ sender: UIButton) {
guard let thisTitle = sender.titleLabel?.text else { return }
playSound(thisTitle: thisTitle)
}
func playSound(thisTitle: String) {
guard let url = Bundle.main.url(forResource: thisTitle, withExtension: "wav") else { return }
do {
try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default)
try AVAudioSession.sharedInstance().setActive(true)
player = try AVAudioPlayer(contentsOf: url, fileTypeHint: AVFileType.mp3.rawValue)
guard let player = player else { return }
player.play()
} catch let error {
print(error.localizedDescription)
}
}
}
728x90
LIST
'SWIFT' 카테고리의 다른 글
Credit Card List & Detail (Realtime Database, Firestore Database) (0) | 2022.12.25 |
---|---|
Egg Timer (0) | 2022.12.24 |
Real Time Notice' s modal (Firebase Remote Config & A/B Test) (0) | 2022.12.20 |
Local Push Notification (0) | 2022.12.19 |
Remote Push Notification(APNs, FCM) (0) | 2022.12.19 |