Skip to content

Instantly share code, notes, and snippets.

View paulmaxgithub's full-sized avatar
🇵🇱
iOS App Developer since 01/2019

Pavel Maximenko paulmaxgithub

🇵🇱
iOS App Developer since 01/2019
View GitHub Profile
@nnsnodnb
nnsnodnb / AnyError.swift
Last active February 29, 2024 17:41
How to upload jpeg image using URLSession.
import Foundation
struct AnyError: Error {
let error: Error
init(_ error: Error) {
self.error = error
}
}
@netgfx
netgfx / addObservers.swift
Last active June 8, 2024 04:59
Add observers to AVPlayer
// listening for current item change
self.audioQueueObserver = self.playerQueue?.observe(\.currentItem, options: [.new]) {
[weak self] (player, _) in
print("media item changed...")
}
// listening for current item status change
self.audioQueueStatusObserver = self.playerQueue?.currentItem?.observe(\.status, options: [.new, .old], changeHandler: {
(playerItem, change) in
if playerItem.status == .readyToPlay {
@aanari
aanari / pod_force_reinstall.sh
Created May 4, 2017 20:37
Reinstall Cocoa Pods and Clear Cache
sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.1.1
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf Pods
pod update