This file contains 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 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 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 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 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
// | |
// CreditCardListViewController.swift | |
// BUPNative | |
// | |
// Created by Venkatnarayansetty, Badarinath on 7/24/19. | |
// | |
import Foundation | |
import UIKit |
This file contains 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_data": { | |
"full_name": "John Sundell", | |
"user_age": 31 | |
} | |
} |
This file contains 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
[ | |
{ "uid": 1, "name": "Avengers: Infinity War", "shortDesc": "Lorem Ipsum", "duration": 120, "thumbnailUrl": "https://s3.amazonaws.com/mobile.scribd.com/ios-interview-test/avg.jpg", "category": 1, "venue": 1 }, | |
] |
This file contains 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
[ | |
{ "uid": 1, "name": "Avengers: Infinity War", "shortDesc": "Lorem Ipsum", "duration": 120, "thumbnailUrl": "https://s3.amazonaws.com/mobile.scribd.com/ios-interview-test/avg.jpg", "category": 1, "venue": 1 }, | |
{ "uid": 2, "name": "Deadpool 2", "shortDesc": "Lorem Ipsum", "duration": 120, "thumbnailUrl": "https://s3.amazonaws.com/mobile.scribd.com/ios-interview-test/deadpool.jpg", "category": 1, "venue": 2 }, | |
{ "uid": 3, "name": "Solo: A Star Wars Movie", "shortDesc": "Lorem Ipsum", "duration": 120, "thumbnailUrl": "https://s3.amazonaws.com/mobile.scribd.com/ios-interview-test/solo.jpg", "category": 1, "venue": 3 }, | |
{ "uid": 4, "name": "Game Night", "shortDesc": "Lorem Ipsum", "duration": 120, "thumbnailUrl": "https://s3.amazonaws.com/mobile.scribd.com/ios-interview-test/gamenight.jpg", "category": 2, "venue": 1 }, | |
{ "uid": 5, "name": "Blockers", "shortDesc": "Lorem Ipsum", "duration": 120, "thumbnailUrl": "https://s3.amazonaws.com/mobile.scribd.com/ios-interview-test/blockers.jpg", "category": 2, " |
This file contains 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
it("Price validations"){ | |
expect(watch.price).toNot(beNil()) | |
expect(watch.price).to(beTruthy()) | |
//evaluating boundary cases | |
expect(watch.price).toNot(beLessThan(0)) | |
expect(watch.price).to(beCloseTo(11, within: 0.69)) | |
expect(watch.price).to(beLessThanOrEqualTo(11.69)) | |
expect(watch.price).to(beGreaterThan(Double.pi)) | |
expect(watch.price).toNot(beGreaterThan(11.69)) |