Skip to content

Instantly share code, notes, and snippets.

View dimkagithub's full-sized avatar

Dmitry dimkagithub

View GitHub Profile
@dimkagithub
dimkagithub / App Store iPhone Sizes
Created October 28, 2022 07:15
App Store iPhone Sizes
https://help.apple.com/app-store-connect/#/devd274dd925
@dimkagithub
dimkagithub / Blur View.swift
Last active June 16, 2022 16:15
Blur View
var blurAnimator: UIViewPropertyAnimator!
let blurEffectView = UIVisualEffectView()
blurEffectView.backgroundColor = .clear
blurEffectView.frame = view.bounds
blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
blurAnimator?.stopAnimation(true)
blurAnimator?.finishAnimation(at: .current)
view.subMenuCollectionView.addSubview(blurEffectView)
blurAnimator = UIViewPropertyAnimator(duration: 1, curve: .linear) { [blurEffectView] in
blurEffectView.effect = UIBlurEffect(style: .dark)
@dimkagithub
dimkagithub / Device Orientation.swift
Created December 7, 2021 10:53
Device Orientation
public enum Model : String {
//Simulator
case simulator = "simulator/sandbox",
//iPod
iPod1 = "iPod 1",
iPod2 = "iPod 2",
iPod3 = "iPod 3",
iPod4 = "iPod 4",
@dimkagithub
dimkagithub / UITableView | Custom Cells
Created November 20, 2021 04:27
UITableView | Custom Cells
https://www.youtube.com/watch?v=YwE3_hMyDZA
@dimkagithub
dimkagithub / CATransition Extension.swift
Last active November 21, 2021 20:25
CATransition Extension
extension CATransition {
func segueFromBottom() -> CATransition {
self.duration = 0.375 //set the duration to whatever you'd like.
self.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
self.type = CATransitionType.moveIn
self.subtype = CATransitionSubtype.fromTop
return self
}
@dimkagithub
dimkagithub / URLSession.swift
Created November 12, 2021 08:32
URLSession
let headers = [
"x-rapidapi-host": "covid-19-data.p.rapidapi.com",
"x-rapidapi-key": "177e0ab6e3msh242bbbb79f55e0fp161398jsna8fc21704db9"
]
let request = NSMutableURLRequest(url: NSURL(
string: "https://covid-19-data.p.rapidapi.com/country/all")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
@dimkagithub
dimkagithub / Dismiss keyboard.swift
Created November 11, 2021 06:42
Dismiss keyboard
private func dismissKeyboardOnTap() {
self.view.addGestureRecognizer(UITapGestureRecognizer(target: self.view, action: #selector(UIView.endEditing(_: ))))
}
@dimkagithub
dimkagithub / Time only comparison.swift
Created November 9, 2021 14:10
Time only comparison
private func checkTime() -> Bool {
let dateFormatter: DateFormatter = DateFormatter()
dateFormatter.timeZone = TimeZone(abbreviation: "PKT")
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
let timeslot = "2021-11-09 16:00:00"
let currentDate = Date()
let date: Date = dateFormatter.date(from: timeslot)!
let currentTime = 60 * Calendar.current.component(.hour, from: currentDate) + Calendar.current.component(.minute, from: currentDate) + (Calendar.current.component(.second, from: currentDate) / 60)
let time = 60 * Calendar.current.component(.hour, from: date) + Calendar.current.component(.minute, from: date) + (Calendar.current.component(.second, from: date) / 60)
@dimkagithub
dimkagithub / XML Parser.swift
Last active November 8, 2021 16:26
XML Parser
import Foundation
struct Currency {
var date: Date?
var numCode: String?
var charCode: String?
var nominal: String?
var nominalDouble: Double?
var name: String?
@dimkagithub
dimkagithub / UserDefaults.swift
Last active November 7, 2021 20:33
UserDefaults
private var variable: Bool {
get {
return UserDefaults.standard.bool(forKey: "variableKey")
}
set {
UserDefaults.standard.setValue(newValue, forKey: "variableKey")
UserDefaults.standard.synchronize()
}
}