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 application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | |
// Override point for customization after application launch. | |
//New code starts from here | |
window = UIWindow(frame: UIScreen.main.bounds) | |
window?.makeKeyAndVisible() | |
let mainVC = ViewController() | |
window?.rootViewController = mainVC |
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
// | |
// MainCollectionViewCell.swift | |
// ShortcutsCollectionView | |
// | |
// Created by Hassan El Desouky on 12/13/18. | |
// Copyright © 2018 Hassan El Desouky. All rights reserved. | |
// | |
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
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | |
// Override point for customization after application launch. | |
window = UIWindow(frame: UIScreen.main.bounds) | |
window?.makeKeyAndVisible() | |
let layout = UICollectionViewFlowLayout() | |
let mainVC = ViewController(collectionViewLayout: layout) | |
window?.rootViewController = UINavigationController(rootViewController: mainVC) | |
return true |
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
import UIKit | |
class AudioVisualizerView: UIView { | |
// Bar width | |
var barWidth: CGFloat = 4.0 | |
// Indicate that waveform should draw active/inactive state | |
var active = false { | |
didSet { | |
if self.active { |
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
//MARK:- Properties | |
var handleView = UIView() | |
//MARK:- Setup Methods | |
fileprivate func setupHandelView() { | |
handleView.layer.cornerRadius = 2.5 | |
handleView.backgroundColor = UIColor(r: 208, g: 207, b: 205) | |
view.addSubview(handleView) | |
handleView.translatesAutoresizingMaskIntoConstraints = false | |
handleView.widthAnchor.constraint(equalToConstant: 37.5).isActive = true | |
handleView.heightAnchor.constraint(equalToConstant: 5).isActive = true |
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
import UIKit | |
public extension UIColor { | |
public convenience init(r: CGFloat, g: CGFloat, b: CGFloat) { | |
self.init(red: r/255, green: g/255, blue: b/255, alpha: 1) | |
} | |
} | |
extension Int { | |
var degreesToRadians: CGFloat { | |
return CGFloat(self) * .pi / 180.0 | |
} |
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
@objc func handleRecording(_ sender: RecordButton) { | |
if recordButton.isRecording { | |
audioView.isHidden = false | |
UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 1, options: .curveEaseOut, animations: { | |
self.handleView.alpha = 1 | |
self.timeLabel.alpha = 1 | |
self.audioView.alpha = 1 | |
self.view.frame = CGRect(x: 0, y: self.view.frame.height, width: self.view.bounds.width, height: -300) | |
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
import UIKit | |
class DSU { | |
private var parent: [Int] = [] | |
private var sz: [Int] = [] | |
init(length: Int) { | |
for i in 0..<length { | |
self.parent.append(i) |
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
// | |
// Created by Hassan El Desouky on 2019-04-01. | |
// | |
#ifndef PST_DSU_H | |
#define PST_DSU_H | |
class DSU { | |
public: |
OlderNewer