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 AVFoundation | |
| protocol AudioRecorder { | |
| func checkPermission(completion: ((Bool) -> Void)?) | |
| /// if url is nil audio will be stored to default url | |
| func record(to url: URL?) | |
| func stopRecording() | |
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
| // | |
| // AGAudioRecorder.swift | |
| // BaseProject | |
| // | |
| // Created by AshvinGudaliya on 17/09/18. | |
| // Copyright © 2018 AshvinGudaliya. All rights reserved. | |
| // | |
| import UIKit | |
| import AVFoundation |
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
| // | |
| // CoreDataController.swift | |
| // | |
| // Created by Keith Harrison http://useyourloaf.com | |
| // Copyright (c) 2017 Keith Harrison. All rights reserved. | |
| // | |
| // Redistribution and use in source and binary forms, with or without | |
| // modification, are permitted provided that the following conditions are met: | |
| // | |
| // 1. Redistributions of source code must retain the above copyright |
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 struct TextSize { | |
| fileprivate struct CacheEntry: Hashable { | |
| let text: String | |
| let font: UIFont | |
| let width: CGFloat | |
| let insets: UIEdgeInsets | |
| fileprivate var hashValue: Int { | |
| return text.hashValue ^ Int(width) ^ Int(insets.top) ^ Int(insets.left) ^ Int(insets.bottom) ^ Int(insets.right) |
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
| guard var components = URLComponents(string: urlString) else {return} | |
| components.queryItems = [ URLQueryItem(name: "jid", value: jid), URLQueryItem(name: "key", value: encrypted)] | |
| components.percentEncodedQuery = components.percentEncodedQuery?.replacingOccurrences(of: "+", with: "%2B") | |
| let url = components.url |
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 | |
| extension CAGradientLayer { | |
| enum Point { | |
| case topLeft | |
| case centerLeft | |
| case bottomLeft | |
| case topCenter |
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
| extension UISegmentedControl { | |
| func removeBorder(){ | |
| self.tintColor = UIColor.clear | |
| self.backgroundColor = UIColor.clear | |
| self.setTitleTextAttributes( [NSAttributedString.Key.foregroundColor : UIColor.stavkrugDarkBlue], for: .selected) | |
| self.setTitleTextAttributes( [NSAttributedString.Key.foregroundColor : UIColor.gray], for: .normal) | |
| } |
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 transition: CATransition = CATransition() | |
| transition.duration = 0.5 | |
| transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut) | |
| transition.type = CATransitionType.reveal | |
| transition.subtype = CATransitionSubtype.fromLeft | |
| self.view.window!.layer.add(transition, forKey: nil) | |
| self.dismiss(animated: false, 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
| extension Array{ | |
| public mutating func appendDistinct<S>(contentsOf newElements: S, where condition:@escaping (Element, Element) -> Bool) where S : Sequence, Element == S.Element { | |
| newElements.forEach { (item) in | |
| if !(self.contains(where: { (selfItem) -> Bool in | |
| return !condition(selfItem, item) | |
| })) { | |
| self.append(item) | |
| } | |
| } | |
| } |