Skip to content

Instantly share code, notes, and snippets.

View Abhishek-NickelFox's full-sized avatar
🎯
Focusing

Abhishek Thapliyal Abhishek-NickelFox

🎯
Focusing
  • NickelFox
  • Noida
View GitHub Profile

Note

Apple will reject apps that are using private url schemes (Ugh, Apple....) if they are pretty much obvius. Some apps are rejected and others are not, so, be aware of this issue before implementing any of those URL's in your app as a feature.

Updates

  • [UPDATE 4] iOS 10 update: apparently settings now can be reached using App-Pref instead of prefs
  • [UPDATE 3] For now you just can use url schemes to open your apps's settings with Swift 3.0 (Xcode 8). I'll keep you informed when OS preferences can be reached
  • [UPDATE 2] The openURL() method of UIApplication is now deprecated. You should use application(_:open:options:) instead
  • [UPDATE 1] Not yet tested in iOS 10. It will fail because of policies changes in URL scheme handling.
extension AppDelegate {
func application(_ app: UIApplication,
open url: URL,
options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
let userDefaults = UserDefaults(suiteName: "group.com.nickelfox.testpush")
if let key = url.absoluteString.components(separatedBy: "=").last,
let sharedArray = userDefaults?.object(forKey: key) as? [Data] {
//
// ShareViewController.swift
// ImageShare
//
// Created by Abhishek on 19/09/17.
// Copyright © 2017 Nickelfox. All rights reserved.
//
import UIKit
import Social
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var imgCollectionView: UICollectionView!
var cellItems: [CellModel] = []
var imagePicker: UIImagePickerController?
override func viewDidLoad() {
import UIKit
struct CellModel {
var image: UIImage
}
class ImageCollectionCell: UICollectionViewCell {
@IBOutlet weak var imgView: UIImageView!
@Abhishek-NickelFox
Abhishek-NickelFox / collectionCellSizes.md
Created June 29, 2017 13:01 — forked from chenr2/collectionCellSizes.md
Swift: Handle rotation for UICollectionView cell sizes

Handle rotation for UICollectionView cell sizes

Requires iOS 8+

Say you want 3 cells per row in portrait, but 4 cells in landscape. First calculate the cell dimensions based on the screen width and a padding of 5.

var cellsPerRow:CGFloat = 3
let cellPadding:CGFloat = 5