Skip to content

Instantly share code, notes, and snippets.

View SebastianOsinski's full-sized avatar

Sebastian Osiński SebastianOsinski

View GitHub Profile
import SwiftUI
struct NumbersCollectionView : UIViewRepresentable {
@Binding var numbers: [Int]
func makeUIView(context: Context) -> UICollectionView {
let layout = UICollectionViewFlowLayout()
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
collectionView.backgroundColor = .white
class Person: NSObject {
@objc let name: String
@objc let age: Int
@objc let nicknames: [String]
init(name: String, age: Int, nicknames: [String]) {
self.name = name
self.age = age
self.nicknames = nicknames
}
curl -v \
-d '{"aps": {"content-available": 1}, "del-id": "1234"}' \
-H "apns-topic: <YOUR APP BUNDLE ID>" \
--http2 \
--cert <PATH TO YOUR CERTIFICATE IN PEM FORMAT> \https://api.development.push.apple.com/3/device/<DEVICE TOKEN>
curl -v \
-d '{"aps": {"alert": "This notification will be removed"}}' \
-H "apns-topic: <YOUR APP BUNDLE ID>" \
-H "apns-collapse-id: 1234" \
--http2 \
--cert <PATH TO YOUR CERTIFICATE IN PEM FORMAT> \https://api.development.push.apple.com/3/device/<DEVICE TOKEN>
import UIKit
import UserNotifications
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
application.registerForRemoteNotifications()
@SebastianOsinski
SebastianOsinski / KeyframeAnimator.swift
Created February 22, 2018 12:18
Thin wrapper for UIView.animateKeyframes
import UIKit
final class KeyframeAnimator {
private struct AnimationsData {
let animations: Animations
let relativeTimeStart: Double
let relativeDuration: Double
}