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 Foundation | |
| import AlamofireImage | |
| import JSQMessagesViewController | |
| import NVActivityIndicatorView | |
| class AsyncPhotoMediaItem: JSQPhotoMediaItem { | |
| var asyncImageView: UIImageView! | |
| var url : URL? | |
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 imageView = AsyncPhotoMediaItem2(withURL: URL(string: mediaUrl)!) | |
| if senderId == Auth.auth().currentUser!.uid { | |
| newImg?.appliesMediaViewMaskAsOutgoing = true | |
| } else { | |
| newImg?.appliesMediaViewMaskAsOutgoing = false | |
| } | |
| self.messages.append(JSQMessage(senderId: senderId, senderDisplayName: displayName, date: timeStamp, media: imageView)); | |
| self.finishReceivingMessage() |
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
| // | |
| // AlbumsTableViewCell.swift | |
| // InfiniteLibrary | |
| // | |
| // Created by Harry Summers on 5/4/18. | |
| // Copyright © 2018 harrysummers. All rights reserved. | |
| // | |
| import UIKit |
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 updateSearchResults(for searchController: UISearchController) { | |
| let searchText = searchController.searchBar.text ?? "" | |
| var predicate: NSPredicate? | |
| if searchText.count > 0 { | |
| predicate = NSPredicate(format: "(name contains[cd] %@) || (artist.name contains[cd] %@)", searchText, searchText) | |
| } else { | |
| predicate = nil | |
| } | |
| fetchedResultsController.fetchRequest.predicate = predicate |
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 tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController) { | |
| let topIndex = IndexPath(row: 0, section: 0) | |
| if let navController = viewController as? UINavigationController, | |
| navController.childViewControllers.count > 0 { | |
| let childController = navController.childViewControllers[0] | |
| if let vc = childController as? AlbumsTableViewController { | |
| vc.tableView.scrollToRow(at: topIndex, at: .top, animated: true) | |
| } else if let vc = childController as? ArtistsTableViewController { | |
| vc.tableView.scrollToRow(at: topIndex, at: .top, animated: 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
| extension String { | |
| func getAlbumId() -> String? { | |
| let url = self | |
| let base = Constants.BASE_URL_NEW_ALBUM | |
| let start = base.count | |
| if url.contains(base) && url.count > start { | |
| let startIndex = url.index(url.startIndex, offsetBy: start) | |
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) | |
| } | |
| } | |
| } |
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
| 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
| 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 |
OlderNewer