Skip to content

wjdals0304/ios-apple-music

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

애플뮤직 클론 코딩

  • 패스트캠퍼스 iOS 앱 개발 올인원 패키지 Online 클론코딩

사용요소

  • UICollectionReusableView, collectionView, AVFoundation
  • Storyboard

새로 배운 내용

  • UICollectionReusableView
  func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
       
       switch kind {
       case UICollectionView.elementKindSectionHeader:
         .... 
         
       default :
          return UICollectionReusableView() 
          

  • cell 클릭 이벤트 call back clouser

관련 블로그

 class TrackCollectionHeaderView: UICollectionReusableView {

    var tapHandler: ((AVPlayerItem) -> Void)?
   @IBAction func cardTapped(_ sender: UIButton) {
        // TODO: 탭했을때 처리
        
        guard let todaysItem = item else { return }
        tapHandler?(todaysItem)
        
    }
   }
   
   
   
   
 [ViewController]
   
   
  cell.tapHandler = { item -> Void in
                // player 를 띄운다
                let playerStoryboard = UIStoryboard.init(name: "Player", bundle: nil)
                guard let playerVC = playerStoryboard.instantiateViewController(withIdentifier: "PlayerViewController") as? PlayerViewController else { return }
                
                playerVC.simplePlayer.replaceCurrentItem(with: item)
                
                self.present(playerVC, animated: true, completion: nil)
                
                
                
                print("----> item title : \(item.convertToTrack()?.title)")
            }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages