Skip to content

Instantly share code, notes, and snippets.

View biloshkurskyi-ss's full-sized avatar

Serhii Biloshkurskyi biloshkurskyi-ss

View GitHub Profile
#!/usr/bin/env bash
set -e
set -x
# get release number from Xcode build settings
version=$(sed -n '/MARKETING_VERSION/{s/MARKETING_VERSION = //;s/;//;s/^[[:space:]]*//;p;q;}' $BITRISE_SOURCE_DIR/FieldaFreedom.xcodeproj/project.pbxproj)
if [ -z "${version}" ]; then
echo "[ERROR] failed to get MARKETING_VERSION"
exit 1
@biloshkurskyi-ss
biloshkurskyi-ss / Polymorphism
Last active July 30, 2019 11:12
OOP at Swift - Polymorphism
import Foundation
class Vehicle {
var model: String
var make: Int
init(model: String, make: Int) {
self.model = model
self.make = make
}
@biloshkurskyi-ss
biloshkurskyi-ss / Encapsulation
Last active July 30, 2019 11:11
OOP at Swift - Encapsulation
import Foundation
class Vehicle {
var model: String
var make: Int
init(model: String, make: Int) {
self.model = model
self.make = make
}
@biloshkurskyi-ss
biloshkurskyi-ss / Inheritance
Last active July 30, 2019 11:11
OOP at Swift - Inheritance
import Foundation
class Vehicle {
var model: String
var make: Int
init(model: String, make: Int) {
self.model = model
self.make = make
}
@biloshkurskyi-ss
biloshkurskyi-ss / Abstraction
Created July 29, 2019 09:49
OOP at Swift - Abstraction
import Foundation
class Vehicle {
var model: String
var make: Int
init(model: String, make: Int) {
self.model = model
self.make = make
}
@biloshkurskyi-ss
biloshkurskyi-ss / Abstraction.playground
Created July 29, 2019 09:33
OOP with Swift examples
import Foundation
class Vehicle {
var model: String
var make: Int
init(model: String, make: Int) {
self.model = model
self.make = make
}
@biloshkurskyi-ss
biloshkurskyi-ss / collection_protocols_sequences.playground
Created November 9, 2018 15:23
Sequences with IteratorProtocol examples
import Foundation
// MARK: - Sequences
struct ConstantIterator: IteratorProtocol {
typealias Element = Int
mutating func next() -> Element? {
return 1
}
}
@biloshkurskyi-ss
biloshkurskyi-ss / set_swift_version.post_install.ruby
Created September 18, 2018 14:46 — forked from DaveWoodCom/set_swift_version.post_install.ruby
`post_install` hook to set the Swift version of pods (add to the end of your project's podfile)
post_install do |installer|
print "Setting the default SWIFT_VERSION to 4.0\n"
installer.pods_project.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.0'
end
installer.pods_project.targets.each do |target|
if ['SomeTarget-iOS', 'SomeTarget-watchOS'].include? "#{target}"
print "Setting #{target}'s SWIFT_VERSION to 3.0\n"
target.build_configurations.each do |config|
import Foundation
import RxSwift
protocol EditTimeEntryType {
var projectIds: Variable<[String]?> { get }
var projectsNames: Observable<String?> { get }
var isValid: Observable<Bool> { get }
var realmService: RealmProjectsServiceProtocol { get }
var interval: Variable<DateInterval> { get }
var type: EditTimeEntryViewModel.ScreenType { get }
@biloshkurskyi-ss
biloshkurskyi-ss / gist:c11b94391a67ddf2b85f01e49b40cf42
Created January 27, 2018 19:11
SWIFT.SOLID.DependencyInversion.Good
protocol VendorType {
func process(order: Order, success: () -> Void, failure: () -> Void)
}
class Administrator: VendorType {
func process(order: Order, success: () -> Void, failure: () -> Void) { /* process order */ }
}
class Seller: VendorType {
func process(order: Order, success: () -> Void, failure: () -> Void) { /* process order */ }
}