Skip to content

Instantly share code, notes, and snippets.

View schevgeny's full-sized avatar

schevgeny schevgeny

View GitHub Profile
@schevgeny
schevgeny / lock_theme.swift
Created May 4, 2021 14:44
lock theme style
if #available(iOS 13.0, *) {
window?.overrideUserInterfaceStyle = .light
}
@schevgeny
schevgeny / gist:9a480e13ad54d64d80dd10bd01ec2613
Created May 4, 2021 10:43
Информация о соответствии экспортным требованиям
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
@schevgeny
schevgeny / gist:4b6940214c090ce430ce70de5d440b1a
Last active July 12, 2021 11:42
Удаление cocoapods из проекта В некоторых случаях может потребоваться полностью удалить cocoapods из вашего проекта. Выполните следующее в каталоге своего проекта.
pod deintegrate
pod cache clean --all
pod install
rm Podfile
Если вы пытаетесь переустановить только его, попробуйте только pod deintegrate, не трогая файл модуля и кеш. За ним следует pod install. Если это не сработает, используйте все три приведенные выше команды и начните с начала.
Возможно, вам придется установить pod deintegrate и pod clean, если вы еще этого не сделали. Для этого запустите sudo gem install cocoapods-deintegrate cocoapods-clean.
//list cocoapods
//uninstall all cocoapods
gem list --local | grep cocoapods | awk '{print $1}' | xargs sudo gem uninstall
//install homebrew
https://brew.sh/index_ru
//install cocoapods
https://formulae.brew.sh/formula/cocoapods
@schevgeny
schevgeny / requestTrackingPermission.swift
Last active August 31, 2021 11:55
How to add the AppTrackingTransparency permission to your iOS apps. iOS 14 get user consent with Facebook SDK
//add to info.plist - "Privacy - Tracking Usage Description"
// "Allow tracking now to stop seeing irrelevant ads. We never rent or sell your data."
//pod 'FBAudienceNetwork'
import FBAudienceNetwork
import AppTrackingTransparency
fileprivate func requestTrackingPermission(completion: @escaping (() -> ())) {
AnalyticsManager.logEvent(type: .requestTrackingPermission, parameters: ["ios": UIDevice.current.systemVersion ])
extension UIButton {
func shake() {
let animation = CAKeyframeAnimation(keyPath: "transform.translation.x")
animation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.linear)
animation.duration = 0.6
animation.values = [-20.0, 20.0, -20.0, 20.0, -10.0, 10.0, -5.0, 5.0, 0.0 ]
layer.add(animation, forKey: "shake")
}
let monitor = NWPathMonitor(requiredInterfaceType: .wifi)
monitor.pathUpdateHandler = { path in
if path.usesInterfaceType(.wifi) {
print("WIFI")
} else {
print("NO WIFI")
}
}
monitor.start(queue: .main)
@schevgeny
schevgeny / printTime.swift
Created January 25, 2021 12:27 — forked from anvarazizov/printTime.swift
print time in swift with milliseconds
func printDate(string: String) {
let date = Date()
let formatter = DateFormatter()
formatter.dateFormat = "HH:mm:ss.SSSS"
print(string + formatter.string(from: date))
}