Skip to content

Instantly share code, notes, and snippets.

View schevgeny's full-sized avatar

schevgeny schevgeny

View GitHub Profile
@schevgeny
schevgeny / gist:3579a56ef474992c744b382cb7510e21
Created March 13, 2024 17:27
SubscriptionManager.swift
import StoreKit
import SwiftyStoreKit
typealias PurchaseHandler = (_ transactionId: String?, _ success: Bool, _ error: Error?) -> ()
final class SubscriptionManager: ObservableObject {
static let shared = SubscriptionManager()
@Published var hasActiveSubscription = false
post_install do |installer|
# installer.pods_project.targets.each do |target|
# flutter_additional_ios_build_settings(target)
# end
installer.generated_projects.each do |project|
project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
end
@schevgeny
schevgeny / .swift
Created January 26, 2023 14:42 — forked from pakisha/.swift
PHAsset
extension PHAsset {
// MARK: - Public methods
func getAssetThumbnail(size: CGSize) -> UIImage {
let manager = PHImageManager.default()
let option = PHImageRequestOptions()
var thumbnail = UIImage()
option.isSynchronous = true
manager.requestImage(for: self, targetSize: size, contentMode: .aspectFill, options: option, resultHandler: {(result, info)->Void in
@schevgeny
schevgeny / gist:a4fa332e65ae3d73ff0c3ca742bcca9c
Created December 9, 2022 08:40
selected Development Team for Pod Bundles
post_install do |installer|
installer.generated_projects.each do |project|
project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings["DEVELOPMENT_TEAM"] = "Your Team ID"
end
end
end
end
@schevgeny
schevgeny / tabBarNotificationIcon.swift
Created October 12, 2022 20:52
How to create Tab Bar and Notification icon by using SwiftUI.
@State var selectedView = 0
var position: CGFloat = 2
var nTab: CGFloat = 4
var body: some View {
GeometryReader { geometry in
ZStack(alignment: .bottomLeading) {
TabView(selection: self.$selectedView) {
HomeView()
@schevgeny
schevgeny / gist:ff2ef0643f6e08446813077138f941db
Last active August 1, 2022 12:39
New APNS Provider API and PHP
if(defined('CURL_HTTP_VERSION_2_0')){
$device_token = '...';
$pem_file = 'path to your pem file';
$pem_secret = 'your pem secret';
$apns_topic = 'your apns topic. Can be your app bundle ID';
$sample_alert = '{"aps":{"alert":"hi","sound":"default"}}';
$url = "https://api.development.push.apple.com/3/device/$device_token";
поиск файлов по содержащимуся тексту
grep -rnw '/путь/к/папке/с/файлами' -e "шаблон"
чтение фала
cat /home/john/RESULTS.txt - маленький
less /home/john/RESULTS.txt - большой
@schevgeny
schevgeny / gist:1234d3593cdedf9b15874146aba3c48a
Last active August 17, 2022 08:59
unable to install app xcode
Xcode -> Window -> Devices and Simulators
-> Right click on your device -> Show Provisioning Profiles...
-> Select Provisioning Profile -> - Remove selected profiles
rm -rf ~/Library/Developer/Xcode/DerivedData/ && rm -rf ~/Library/Caches/org.swift.swiftpm/
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
fileprivate func requestReview() {
if #available(iOS 10.3, *) {
//let isShow = CONFIG_MANAGER.getBool(.ifNeedRequestReview)
//if isShow == true {
if let scene = UIApplication.shared.connectedScenes.first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene {
SKStoreReviewController.requestReview(in: scene)
}
//}
}
}