Skip to content

Instantly share code, notes, and snippets.

View olgusirman's full-sized avatar

olgusirman olgusirman

View GitHub Profile
@olgusirman
olgusirman / gist:ddb51a4dbb06cba02f70c93a953c4202
Created October 12, 2018 14:29
Static & Dynamic libraries.txt
Static & Dynamic libraries
https://www.ca.com/en/blog-developers/dynamic-versus-static-framework-in-ios.html
https://stackoverflow.com/a/15331319/3215761
Static library - a unit of code linked at compile time, which does not change.
However, iOS static libraries are not allowed to contain images/assets (only code). You can get around this challenge by using a media bundle though.
A better, more formal definition can be found on Wikipedia here.
Dynamic library - a unit of code and/or assets linked at runtime that may change.
However, only Apple is allowed to create dynamic libraries for iOS . You're not allowed to create these, as this will get your app rejected. (See this other SO post for confirmation and reasoning on such).
@olgusirman
olgusirman / gist:2b0aecd1c3a519f9bc83d78deac4e8a3
Created October 12, 2018 14:39
Sample generate strings from Localizable file
# generate strings for all swift files (even in nested directories)
$ find . -name \*.swift | xargs genstrings -o .
# See results
$ cat Localizable.strings
/* Test */
"This is the test message." = "This is the test message.";
$
@olgusirman
olgusirman / iterm2.md
Created February 19, 2019 10:46 — forked from squarism/iterm2.md
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@olgusirman
olgusirman / LetterManager.swift
Created July 10, 2019 15:23
These manager gets that array inside array and sorted and separate from first letter
protocol Letterable {
var name: String { get }
}
final class LetterManager<T: Letterable> {
// MARK : - Publics
func getTheFirstLetters(with section: Int) -> String {
var allTitles = [String]()
@olgusirman
olgusirman / CustomStringConvertible+Description.swift
Created July 10, 2019 15:27
Description extension for CustomStringConvertible protocol, usage for especially print objects
extension CustomStringConvertible {
var description : String {
var description: String = ""
description = "***** \(type(of: self)) *****\n"
let selfMirror = Mirror(reflecting: self)
for child in selfMirror.children {
if let propertyName = child.label {
description += "\(propertyName): \(child.value)\n"
}
}
@olgusirman
olgusirman / setDevelopmentLanguage.rb
Last active January 20, 2020 13:42 — forked from ralfebert/xcode_set_development_language_de.rb
Ruby script that uses cocoapods Xcodeproj to set development_region / known_regions of an Xcode project to any language
#!/usr/bin/env ruby
require 'fileutils'
require 'xcodeproj'
unless ARGV.count == 2
puts "Usage: xcode_set_development_region.rb [project] [region]"
exit(1)
end
@olgusirman
olgusirman / TipsAboutSFSymbols
Created February 6, 2020 15:14
Here are some nice tips I learned about #SFSymbols from the great talk #wwdc19
- Request your designers a SVG format which include all symbol configurations. Apple has a cool template file for adaptation all the icons that you use. It will save you in a big headache :]
- Using scale with SymbolConfigurations is very handy. Your symbols will always be fit regardless from where to use them. Especially you need to consider if you are using custom fonts.
- Just provide two images with the same name for iOS13 and bitmap versions for older IOS version. The system will use correct version.
- Don’t confuse symbol points sizes and screen point sizes. Symbol points sizes represents typographically and values wouldn’t match with screen point sizes.
for your icons, get the regular size first and update to pointSize instead of setting constraints width and height, It would be much more performance and correct way about icons centered.
- Prefer horizontal and vertical centering over edge alignment, try to build your layouts smallest element to largest element
@olgusirman
olgusirman / update_build_number.sh
Created April 21, 2020 16:14
This script updated the build number for current branch
#!/bin/bash
# update_build_number.sh
# Usage: `update_build_number.sh [branch]`
# Run this script after the 'Copy Bundle Resources' build phase
# Ref: http://tgoode.com/2014/06/05/sensible-way-increment-bundle-version-cfbundleversion-xcode/
branch=${1:-'master'}
buildNumber=$(expr $(git rev-list $branch --count) - $(git rev-list HEAD..$branch --count))
echo "Updating build number to $buildNumber using branch '$branch'."
@olgusirman
olgusirman / updateBuildNumberAndPushTag.sh
Last active April 25, 2020 22:03
Gets latest tag, increment build number, set a commit with this tag and push
#!/bin/bash
echo "Please set an input your tag description, ticket number etc."
read TAG_DESCRIPTION
# get latest tag number
VERSION=`git describe --abbrev=0 --tags`
echo "CURRENT VERSION => $VERSION"
#replace . with space so can split into an array
@olgusirman
olgusirman / updateVersionNumberAndPushTag.sh
Last active April 25, 2020 22:03
Gets latest tag, increment build number and version number, set a commit with this tag and push
#!/bin/bash
# Get Tags Latest number, increment and set build and version number
echo "Please set an input your tag description, ticket number etc."
read TAG_DESCRIPTION
# get latest tag number
VERSION=`git describe --abbrev=0 --tags`
echo "CURRENT VERSION => $VERSION"