Skip to content

Instantly share code, notes, and snippets.

View IvanovDeveloper's full-sized avatar

Andrew Ivanov IvanovDeveloper

  • Ukraine
View GitHub Profile
@IvanovDeveloper
IvanovDeveloper / IconOffsetMapboxExample
Created April 21, 2022 14:00
Mapbox Icon offset configuration example
let layer = MGLSymbolStyleLayer(identifier: identifier, source: source)
layer.iconOffset = NSExpression(forConstantValue: CGVector(dx: 0, dy: 0))
extension STRechabilityError: LocalizedError {
var errorDescription: String? {
switch self {
case .noInternetConnection: return "There is no internet connection"
}
}
}
extension STAuthenticationError: LocalizedError {
@IvanovDeveloper
IvanovDeveloper / Database.swift
Last active August 3, 2020 15:49
Realm Database initialisation in the app with migration issue from 4.4.0 -> 5.3.0
class Database: NSObject {
@objc static let shared = Database()
private let schemaVersion: UInt64 = 1 // In the prod version this value was incremented.
static var realm: Realm? {
do {
let realm = try Realm()
return realm
class ArticlePhygitalDetail
{
ArticleReference[] AutresReferences { get; set; }
EmplacementMagasin EmplacementStockMagasin { get; set; }
ArticlePhygitalDimensions Dimensions { get; set; }
ArticlePhygitalTaxe[] Taxes { get; set; }
ArticlePhygitalBase Parent { get; set; }
ArticleDispoDigiSign[] Disponibilites { get; set; }
ArticlePhygitalVersion[] Instances { get; set; }
String[] Documents { get; set; }
import Foundation
import UIKit
import Swifter
import WebKit
public enum BLTPaymentViewControllerError: Error, LocalizedError {
case orderTokenNotFound
case resourceNotFound(_ resourcesName: String)
case javaScriptError(_ errorMessage: String)
case httpResponseError(statusCode: Int)
@IvanovDeveloper
IvanovDeveloper / RedirectToAppScriptExample
Last active February 13, 2017 10:12
Для того чтобы открыть iOS приложение по ссылке необходимо реализовать скрипт который открывает другую ссылку с которой связано приложение.
// Этот скрипт нужно реализовать в двух местах.
// 1. При регистрации когда происходит запрос confirmation_token
// 2. При восстановлении пароля
// P.S. Эти скрипты я проверял, они рабочие. Главнное чтобы можно было генерировать необходимую ссылку
<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
setTimeout(function () {
// Если приложение не установленно выполняеться эта функция. Она перенаправляет в аппстор для скачивания необходимого приложения.
@IvanovDeveloper
IvanovDeveloper / RedirectToAppScriptExample
Created February 13, 2017 09:54
Для того чтобы открыть iOS приложение по ссылке необходимо реализовать скрипт который открывает другую ссылку с которой связано приложение.
<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
setTimeout(function () {
//This link will be changed later. If application not installed at device, this link for opening the app in appstore.
window.location = "https://itunes.apple.com/us/app/swelp-focus-on-the-core/id1148572155?l=ru&ls=1&mt=8";
}, 25);
//Link for product should be "mainAndMe://products/[current product id]";
//Link for store should be "mainAndMe://stores/[current store id]";
@IvanovDeveloper
IvanovDeveloper / RedirectToAppScriptExample
Created February 13, 2017 09:54
Для того чтобы открыть iOS приложение по ссылке необходимо реализовать скрипт который открывает другую ссылку с которой связано приложение.
<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
setTimeout(function () {
//This link will be changed later. If application not installed at device, this link for opening the app in appstore.
window.location = "https://itunes.apple.com/us/app/swelp-focus-on-the-core/id1148572155?l=ru&ls=1&mt=8";
}, 25);
//Link for product should be "mainAndMe://products/[current product id]";
//Link for store should be "mainAndMe://stores/[current store id]";
#import <CoreLocation/CoreLocation.h>
@interface LocationManager () <CLLocationManagerDelegate>
@property (nonatomic, strong) CLLocationManager *locationManager;
@end
@implementation
- (id)init
self = [super init];
//Create cell from storyboard
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"PlayerCell"];
//Create cell programmatically
static NSString *cellIdentifier = @"cellIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil)
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];