Skip to content

Instantly share code, notes, and snippets.

Badarinath Venkatnarayansetty badrinathvm

Block or report user

Report or block badrinathvm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View AnimateParticlesWithCustomPath.swift
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
View CustomPath.swift
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)
View AnimationForExpandableButton.swift
fileprivate func performAnimation() {
let screenSize = UIScreen.main.bounds
let stackedButtons = self.buttonStackView.arrangedSubviews
let animation = UIViewPropertyAnimator(duration: 0.3, curve: .easeOut) {
//hide or show the stackview.
self.buttonStackView.isHidden = self.buttonsAreHidden
@badrinathvm
badrinathvm / Animate.swift
Created Sep 2, 2019
Animate by considering the height Constraint
View Animate.swift
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)
}
@badrinathvm
badrinathvm / AddBlurEffectView.swift
Last active Sep 2, 2019
Adding a blur Effect View
View AddBlurEffectView.swift
let blurredEffectView:UIVisualEffectView = {
let blurEffect = UIBlurEffect(style: .dark)
let blurredEffectView = UIVisualEffectView(effect: blurEffect)
blurredEffectView.translatesAutoresizingMaskIntoConstraints = false
return blurredEffectView
}()
func setupBlurView() {
self.view.addSubview(blurredEffectView)
@badrinathvm
badrinathvm / Container.swift
Last active Sep 2, 2019
Setting up Container View Controller
View Container.swift
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),
@badrinathvm
badrinathvm / DynamicHeight.swift
Created Jul 26, 2019
dynamic height of the collectionView
View DynamicHeight.swift
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.
*/
View CreditCardViewController.swift
//
// CreditCardListViewController.swift
// BUPNative
//
// Created by Venkatnarayansetty, Badarinath on 7/24/19.
//
import Foundation
import UIKit
View test.json
{
"user_data": {
"full_name": "John Sundell",
"user_age": 31
}
}
View sample.json
[
{ "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 },
]
You can’t perform that action at this time.