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 func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { | |
| let height = calculateDynamicHeightOftheCell(index: indexPath.row) | |
| return CGSize(width: self.collectionView.bounds.width, height: height) | |
| } | |
| /** | |
| Calculates the height of the card based on the content inside the view. | |
| - parameters: | |
| - index = identifies which cell it is. | |
| */ |
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 setupContainerView() { | |
| [containerVC,notchVC].forEach { (viewController) in | |
| self.view.addSubview(viewController.view) | |
| } | |
| heightConstraint = containerVC.view.heightAnchor.constraint(equalToConstant: 0) | |
| notchBottomConstraint = notchVC.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor) | |
| NSLayoutConstraint.activate([ | |
| containerVC.view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor), | |
| containerVC.view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor), |
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 blurredEffectView:UIVisualEffectView = { | |
| let blurEffect = UIBlurEffect(style: .dark) | |
| let blurredEffectView = UIVisualEffectView(effect: blurEffect) | |
| blurredEffectView.translatesAutoresizingMaskIntoConstraints = false | |
| return blurredEffectView | |
| }() | |
| func setupBlurView() { | |
| self.view.addSubview(blurredEffectView) | |
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 animate() { | |
| let screenSize = UIScreen.main.bounds | |
| let heightValue = screenSize.size.height / 2 | |
| self.view.layoutIfNeeded() | |
| UIView.animate(withDuration: 1.0, delay: 0, usingSpringWithDamping: 1.0, initialSpringVelocity: 1.0, options: UIView.AnimationOptions.curveEaseIn, animations: { | |
| self.notchBottomConstraint.constant = -heightValue | |
| self.heightConstraint.constant = heightValue | |
| self.view.layoutIfNeeded() | |
| }, completion: nil) | |
| } |
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 customPath() -> UIBezierPath { | |
| let path = UIBezierPath() | |
| path.move(to: CGPoint(x: 0, y: 200)) | |
| let endPoint = CGPoint(x: 500, y: 200) | |
| let randomYShift = 200 + drand48() * 300 | |
| let cp1 = CGPoint(x: 100, y: 100 - randomYShift) | |
| let cp2 = CGPoint(x: 200, y: 100 + randomYShift + 400) |
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 ViewController: UIViewController { | |
| let width: CGFloat = 240.0 | |
| let height: CGFloat = 160.0 | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| let sineView = HingeView(frame: UIScreen.main.bounds) | |
| sineView.backgroundColor = .yellow |
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 SwiftUI | |
| struct MoreCircleShapes: View { | |
| var body: some View { | |
| VStack(spacing: 10) { | |
| Circle().fill(Color.purple).frame(height: 100).padding() | |
| Text("Note : Fill Modifier apples specifically to shapes nopt a view.") | |
| .frame(maxWidth: .infinity) |
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
| { | |
| "user": { | |
| "type": "lead", | |
| "id": 146179, | |
| "name": "Rubamaga", | |
| "email": "[email protected]", | |
| "user_id": "22449", | |
| "phone": null, | |
| "created_at": 1506500350, | |
| "signed_up_at": null, |
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
| @available(iOS 13.0, *) | |
| struct SwiftUIView: View { | |
| var body: some View { | |
| VStack { | |
| Text("Welcome to SwiftUI") | |
| .padding() | |
| .font(.system(size: 15)) | |
| Spacer() | |
| } |