Skip to content

Instantly share code, notes, and snippets.

View designablebits's full-sized avatar
🎯
Focusing

Designable Bits designablebits

🎯
Focusing
View GitHub Profile
@mrpcalcantara
mrpcalcantara / SnapshotDiffableDataSource.swift
Last active April 5, 2023 20:24
Example on how to use the UITableViewDiffableDataSource
//
// SnapshotDiffableDataSource.swift
// testDiffableDataSource
//
// Created by Miguel Alcântara on 22/01/2020.
// Copyright © 2020 Miguel Alcântara. All rights reserved.
//
import UIKit
@stinger
stinger / CombineFetcher.swift
Last active January 28, 2023 18:07
Combine - fetching data using URLSession publishers
import Foundation
import Combine
enum APIError: Error, LocalizedError {
case unknown, apiError(reason: String)
var errorDescription: String? {
switch self {
case .unknown:
return "Unknown error"
@yusuke024
yusuke024 / ViewController.swift
Created November 16, 2018 03:15
Recording video with AVAssetWriter
import UIKit
import AVFoundation
class ViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
switch AVCaptureDevice.authorizationStatus(for: .video) {
case .notDetermined:
@tjeerdintveen
tjeerdintveen / inspect.swift
Created October 18, 2018 13:24
inspect as an extension on Sequence
extension Sequence {
public func inspect(
_ body: (Element) throws -> Void
) rethrows -> Self {
for element in self {
try body(element)
}
return self
}
}
import 'package:flutter/material.dart';
import 'package:csv/csv.dart';
import 'dart:async' show Future;
import 'package:flutter/services.dart' show rootBundle;
class TableLayout extends StatefulWidget {
@override
_TableLayoutState createState() => _TableLayoutState();
}
@jediyeti
jediyeti / GoogleCalendarManager.swift
Last active March 20, 2024 10:08
Example of app's events syncing to Google Cal
import Foundation
import GoogleSignIn
import GoogleAPIClientForREST
enum GoogleCalendarManagerError: Error {
case errorWithText(text: String)
}
class GoogleCalendarManager: NSObject {
static let shared = GoogleCalendarManager()
@Nexengineer
Nexengineer / DataHandler.swift
Created January 16, 2018 10:18
EKEVENT Handler class
//
// DataHandler.swift
// NMEventKitDemo
//
// Created by Neeraj Kumar Mishra on 1/15/18.
// Copyright © 2018 Neeraj Kumar Mishra. All rights reserved.
//
import UIKit
import EventKit
@DejanEnspyra
DejanEnspyra / Obfuscator.swift
Created May 31, 2017 17:51
Obfuscation of hard-coded security-sensitive strings.
//
// Obfuscator.swift
//
// Created by Dejan Atanasov on 2017-05-31.
//
import Foundation
class Obfuscator: AnyObject {
@nguyentruongky
nguyentruongky / Auto_Layout_Programmatically.md
Last active August 21, 2019 11:10
Should I implement UI with Storyboard or by Programmatically?

Auto Layout with Storyboard and Programmatically

I started iOS development as a .NET developer. My first impression, Storyboard is really really interesting. 80% UI of my apps is built in Storyboard. I can't imagine how I can develop iOS without Storyboard.

There are many discussions about Auto Layout with Storyboard or Programmatically is better. But no one wins. Everyone has own reason and belief.

This post is my personal opinion. It's written by a developer can't live without Storyboard, and now he abandons it.

3 reasons why he changed to Auto Layout by programmatically.

Why do I abandon Storyboard?