-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: ASMusicKit 프레임워크로 분리 #25
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
40d31c9
chore: MusicKit 사용시 사용자 Media 접근 권한 부여 메시지 수정
moral-life 258c73b
feat: ASMusicAPI 구조체 생성, search 함수 및, ASSong 선언
moral-life dd91756
feat: ASSongs에 아트워크 이미지 URL 추가
moral-life 7752410
merge: 'origin/dev' into 'feat/#13'
moral-life a32e402
fix: plist 오류 수정
moral-life adcbcdc
remove: 모듈 분리이후 원래 파일은 필요없어짐
moral-life bc6d587
feat: ASMusicKit 프레임워크로 분리
moral-life eaf88f6
fix: pbxproj 변경
moral-life f3b4364
fix: switch indent변경, offset 파라미터 추가, import 순서 변경
moral-life File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import MusicKit | ||
|
||
struct ASMusicAPI { | ||
|
||
/// search 결과를 Assong으로 변환 하여 배열로 리턴하는 함수 | ||
/// 노래 검색화면에 기본으로 뜨는 row 개수가 6개이므로 별다른 지정 없으면 기본값 6으로 지정 | ||
func search(for text: String, _ maxCount: Int = 6) async -> [ASSong] { | ||
|
||
let status = await MusicAuthorization.request() | ||
|
||
switch status { | ||
case .authorized: | ||
do { | ||
var request = MusicCatalogSearchRequest(term: text, types: [Song.self]) | ||
request.limit = maxCount | ||
request.offset = 1 | ||
|
||
let result = try await request.response() | ||
let asSongs = result.songs.map { song in | ||
ASSong(title: song.title, artistName: song.artistName) | ||
} | ||
return asSongs | ||
} catch { | ||
print(String(describing: error)) | ||
return [] | ||
} | ||
default: | ||
print("Not authorized to access Apple Music") | ||
return [] | ||
} | ||
} | ||
} | ||
|
||
struct ASSong: Equatable { | ||
let title: String | ||
let artistName: String | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
P3: 함수의 첫시작은 붙여서 작성!
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.
해당파일은 adcbcdc 커밋에서 삭제됐습니다! public 붙이고 린트 수정해서 프레임워크로 옮겨놨어용!