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
| class GradientView: UIImageView { | |
| var gradientColors: [CGColor] = [UIColor.greyishBrown.withAlphaComponent(0.2).cgColor, UIColor.greyishBrown.cgColor] | |
| var locations: [CGFloat]? = [0.0, 1.0] | |
| override func layoutSubviews() { | |
| self.contentMode = .scaleToFill | |
| self.backgroundColor = .hotPink | |
| self.image = drawGradientColor(in: self.bounds, colors: gradientColors) | |
| } |
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, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { | |
| let totalAvailableWidth = collectionView.bounds.width | |
| let padding: CGFloat = 25 | |
| let interSpace: CGFloat = 15 | |
| let numOfCellInaRow: CGFloat = 3 | |
| let cellWidth: CGFloat = (totalAvailableWidth - (padding * 2) - (interSpace * (numOfCellInaRow - 1))) / numOfCellInaRow | |
| /// padding * 2 = leading + trailing space, (interSpace * (numOfCellInaRow - 1)) = totalInterspacing as 3 cells will have 2 interspace | |
| let cellSize = CGSize(width: cellWidth, height: cellWidth) | |
| return cellSize | |
| } |
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 | |
| // Confirm this to your cell/header if using Prototype cell | |
| public protocol ReusableView: AnyObject { | |
| static var defaultReuseIdentifier: String { get } | |
| } | |
| extension ReusableView where Self: UIView { | |
| public static var defaultReuseIdentifier: String { | |
| return String(describing: 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
| // | |
| // ExtensionURLRequest.swift | |
| // | |
| // Created by Abhishek Maurya on 16/07/20. | |
| // Copyright © 2020. All rights reserved. | |
| // | |
| import Foundation | |
| extension URLRequest { |
NewerOlder