This file contains hidden or 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
| fileprivate func getShowingViewController(_ rootViewController: UIViewController) -> UIViewController? { | |
| var isRoot = false | |
| var showViewController: UIViewController? = rootViewController | |
| while (!isRoot) { | |
| if let tempViewController = showViewController?.presentedViewController { | |
| showViewController = tempViewController | |
| } else { | |
| isRoot = true | |
| } | |
| } |
This file contains hidden or 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
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| addAlbumView.viewController = self | |
| } |
This file contains hidden or 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
| let addAlbumView: AddAlbumView = { | |
| let view = AddAlbumView() | |
| view.translatesAutoresizingMaskIntoConstraints = false | |
| return view | |
| }() |
This file contains hidden or 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
| weak var viewController: UIViewController? { | |
| didSet { | |
| setupViewController() | |
| } | |
| } |
This file contains hidden or 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
| import UIKit | |
| class AddAlbumView: UIView { | |
| var albumArt: UIImageView = { | |
| var imageView = UIImageView() | |
| imageView.contentMode = .scaleAspectFill | |
| imageView.translatesAutoresizingMaskIntoConstraints = false | |
| imageView.backgroundColor = UIColor.CustomColors.spotifyDark | |
| return imageView |
This file contains hidden or 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
| func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { | |
| let gif = gifs[indexPath.row] | |
| let cell = collectionView.dequeueReusableCell(withReuseIdentifier: cellId, for: indexPath) as! GifCollectionViewCell | |
| cell.gifView.loadGif(name: gif) | |
| return cell | |
| } | |
| func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { |
This file contains hidden or 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
| lazy var collectionView: UICollectionView = { | |
| let layout = UICollectionViewFlowLayout() | |
| layout.itemSize = CGSize(width: 140, height: 250) | |
| layout.scrollDirection = .horizontal | |
| let collection = UICollectionView(frame: self.view.frame, collectionViewLayout: layout) | |
| collection.translatesAutoresizingMaskIntoConstraints = false | |
| collection.register(GifCollectionViewCell.self, forCellWithReuseIdentifier: cellId) | |
| collection.backgroundColor = UIColor.CustomColors.spotifyDark | |
| collection.bounces = true | |
| collection.alwaysBounceHorizontal = true |
This file contains hidden or 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
| import UIKit | |
| import SpotifyLogin | |
| class SettingsViewController: UIViewController { | |
| var scrollView: UIScrollView = { | |
| var scroll = UIScrollView() | |
| scroll.translatesAutoresizingMaskIntoConstraints = false | |
| scroll.bounces = true | |
| scroll.isScrollEnabled = true |
This file contains hidden or 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
| func animateTransition(using transitionContext: UIViewControllerContextTransitioning) { | |
| let containerView = transitionContext.containerView | |
| let toView = transitionContext.view(forKey: .to)! | |
| let fromView = transitionContext.view(forKey: .from)! | |
| let slideTransform = CGAffineTransform(translationX: toView.frame.width, y: 0) | |
| toView.transform = slideTransform | |
| let finalFrame = CGRect(x: -fromView.frame.width, y: 0, width: fromView.frame.width, height: fromView.frame.height) | |
This file contains hidden or 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
| public override func prepareForDeletion() { | |
| if let artist = artist { | |
| let albums = artist.albums | |
| if albums == nil || albums?.count == 1 { | |
| managedObjectContext?.delete(artist) | |
| } | |
| } | |
| } |
NewerOlder