Skip to content

Instantly share code, notes, and snippets.

View gugell's full-sized avatar

Ilia gugell

  • Genetec
  • Moldova, Chisinau
View GitHub Profile
@gugell
gugell / project.yml
Created May 13, 2022 11:57 — forked from uhooi/project.yml
XcodeGen project spec sample
name: {Project Name}
options:
bundleIdPrefix: {Bundle ID Prefix}
deploymentTarget:
iOS: 13.0
xcodeVersion: "11.3.1" # 変わらない?
# findCarthageFrameworks: true # 余計なフレームワークまで追加されてしまうためコメントアウト
carthageExecutablePath: mint run Carthage/Carthage carthage
@gugell
gugell / offline_map.md
Created October 1, 2020 04:27 — forked from jamiely/offline_map.md
Generating offline maps for iOS applications

Intro

Recently, I had to implement an offline mapping solution for an iOS application. Here's a walkthrough of how to do it.

Summary

I generated a tile database using TileMill. I used the Route-Me iOS library which provides a map view that supports offline tile sources.

TileMill

@gugell
gugell / ServiceLocator.swift
Created June 5, 2019 21:32 — forked from FGoessler/ServiceLocator.swift
A very lightweight ServiceLocator implementation including a module mechanism written in Swift.
import Foundation
public protocol ServiceLocatorModul {
func registerServices(serviceLocator: ServiceLocator)
}
public class ServiceLocator {
private var registry = [ObjectIdentifier:Any]()
public static var sharedLocator = ServiceLocator()
var total:Double {
var result = self.subtotal
if let coupon = self.coupon, coupon.isactive{
//percentage
//fixed
let sums = products.filter{$0.discounted}.compactMap({ ($0.price ?? 0.0) * Double($0.qty ?? 0) })
let totalDiscounted = sums.reduce(0.0, +)
if coupon.type == "fixed"{
result -= (totalDiscounted - coupon.value)
@gugell
gugell / ViewControllerLifecycleBehavior.swift
Created December 12, 2018 08:07 — forked from BohdanOrlov/ViewControllerLifecycleBehavior.swift
Swift implementation of idea that manny view controller can do light work: http://khanlou.com/2016/02/many-controllers/
public protocol ViewControllerLifecycleBehavior {
func afterLoading(_ viewController: UIViewController)
func beforeAppearing(_ viewController: UIViewController)
func afterAppearing(_ viewController: UIViewController)
func beforeDisappearing(_ viewController: UIViewController)
func afterDisappearing(_ viewController: UIViewController)
@gugell
gugell / CollectionViewDataSource.swift
Created December 4, 2018 13:01 — forked from andymatuschak/CollectionViewDataSource.swift
Type-safe value-oriented collection view data source
//
// CollectionViewDataSource.swift
// Khan Academy
//
// Created by Andy Matuschak on 10/14/14.
// Copyright (c) 2014 Khan Academy. All rights reserved.
//
import UIKit
@gugell
gugell / ADVDataSource.h
Created December 4, 2018 11:05 — forked from advantis/ADVDataSource.h
Generic UITableView/UICollectionView data source for multiple sections
//
// Copyright © 2013 Yuri Kotov
//
#import <Foundation/Foundation.h>
typedef void(^ADVCellConfigurationBlock)(id cell, id object);
@interface ADVDataSource : NSObject <UITableViewDataSource, UICollectionViewDataSource>
import UIKit
@IBDesignable
class UnderlinedTextField: UITextField {
@IBInspectable var borderColor: UIColor = Colors.darkText {
didSet { setNeedsDisplay() }
}
@IBInspectable var borderedWidth: CGFloat = 1 {
import RxSwift
import Action
enum SceneStateOutput {
case idle
case sendingNoRecipient
case sendingSomeRecipients(sendingList: [String: String])
case sending
}
@gugell
gugell / A.LICENSE.md
Created October 22, 2018 21:15 — forked from gonzalezreal/A.LICENSE.md
Using Realm with Value Types

Copyright 2017 Guillermo Gonzalez

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE U