-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] 폴더링 및 앱용량 최적화 #101
[FIX] 폴더링 및 앱용량 최적화 #101
Conversation
가독성을 위한 폴더링
[REFACTOR] foldering
because of the huge file size, edited file extension.
[REFACTOR] replace audio files and refactor audio manager
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
항상 SpaceOver 아껴줘서 감사합니당🙏🙏
public func playAudio(fileName: String) { | ||
guard let url = Bundle.main.url(forResource: "Detail_\(fileName)", withExtension: "aif") else { return } | ||
|
||
do { | ||
try audioPlayer = AVAudioPlayer(contentsOf: url) | ||
|
||
audioPlayer?.prepareToPlay() | ||
audioPlayer?.volume = 0.7 | ||
audioPlayer?.volume = 0.5 | ||
audioPlayer?.play() | ||
audioPlayer?.numberOfLoops = -1 | ||
} catch { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
playAudio 메소드는 하나로 합치려는거 아니었나요?🤔🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아 이 메서드는 AudioPlayer 자체 메서드입니다! 제가 합친 것은 detail, search 화면에서 별도로 사용했던 메서드를 합친거랍니당 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥳 이 수많은 파일 계층들을 정리해주다니 , , 넘나 최고에유! 오랜만에 타스 코드 보니까 반갑기도 하구, 짱 좋아요 🥹💕 수고하셨습니다, 레나 :)
/// pre: searching_ vs detail_ | ||
/// fileName: name of body | ||
/// audioExtension: mp3 vs aif vs wav | ||
/// audioVolume: 0.0 ~ 1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 주석들은 아래 playAudio 함수의 parameter에 대한 설명 파트인 것 같아요! 함수 호출 시 꼭 필요한 설명 같지만, 단순히 주석으로 달아두기 보다, 좀 더 나은 방식으로 정리해두면 좋을 것 같은데 ,, 마땅한 아이디어가 떠오르지 않습니다.. 🥲 hoxy 다른 방법이 있을까요?
- enum으로 정의해두는 것도 하나의 방법이 될 것 같네요! (아니면 default 값을 지정해두는 것도,,!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 부분은 정말 생각못했던 점이네요. 좋은 의견 감사합니다!
선택지를 제공하고싶어서 enum으로 해보려했으나 행성 종류가 많아 pre, fileName, audioExtension 모두를 enum 으로 만들기엔 불필요하게 비대해진다고 판단하여 default 값을 설정해두었습니다.
audioManager.playAudio(fileName: planet.planetEnglishName) | ||
audioManager.playAudio(pre: "Detail_", | ||
fileName: planet.planetEnglishName, | ||
audioExtension: "mp3", | ||
audioVolume: 0.4, | ||
isLoop: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
새로운 함수를 호출할 때에는 이렇게 적용되는군요! :) audio 관련된 디테일들을 직접 제어할 수 있어서 훨씬 더 좋은 방법인 것 같습니다.
작업내용
playAudio()
메서드의 각 파라미터에 원하는 접두어 (Detail_
vsSearching_
), 행성 이름 (filename), 확장자 (wav
vsmp3
), 볼륨 크기 (0.0 ~ 1.0), 반복 여부 (true
orfalse
) 를 넣어주면 매번 다른 메서드를 호출하거나 기억하지 않아도 playAudio()기능을 사용할 수 있습니다.0.7
>0.4
로 조정리뷰포인트
Checklist