Skip to content

Instantly share code, notes, and snippets.

@CyrilCermak
CyrilCermak / SwiftCompilation.txt
Last active November 21, 2017 00:43
Swift compile time analyse
This is a quick tutorial for analysing Swift compile time.
3 main steps:
1) Log the whole app build:
xcodebuild -workspace ./App.xcworkspace -scheme App clean build OTHER_SWIFT_FLAGS="-Xfrontend -debug-time-function-bodies" | tee ~/Desktop/compile_log.txt
2) Get sorted data we want from build:
grep '^\d*\.\d*ms' compile_log.txt | sort -n -k1 -r > compile_analyzed.txt
@CyrilCermak
CyrilCermak / Podfile.rb
Last active December 15, 2022 16:39
Podfile for project with frameworks
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
workspace 'App.xcworkspace'
project 'App.xcodeproj'
platform :ios, '10.0'
inhibit_all_warnings!
use_frameworks!
CCPod = Struct.new(:name, :version, :git, :branch)
import Foundation
import UIKit
/**
This is the order of how the frameworks are being compiled.
It starts with CCCore but if CCCore contains other imported framework
then the compiler jumps to that framework.
*/
import CCCore
import CCFeature0
import CCFeature1
/**
Every child flow must implement Flow protocol
- func start: Starts the flow process, it usually decides what is
going to be presented
- var services: Property that contains all the services that are
being used in the app
- var finish: Is a closure that notifies parent Flow
that the child flow is finished.
- var currentVC: Returns view controller that is currently being displayed
*/
public class CCFeature2Flow: Flow {
public var finish: (Flow) -> () = { _ in }
public var services: Services
public var navigation: UINavigationController?
public required init(services: Services, navigationVC: UINavigationController?) {
self.services = services
self.navigation = navigationVC
}
protocol LocalizedStringRepresentable {
var text: String { get }
}
enum LoginLocalization: String, LocalizedStringRepresentable {
//WelcomeVC
case signInSignUp
//SignInSignUpVC
case termsAndCond, signIn, signUp, signUpShort, email, password, repeatPassword,
signInWithFB, signUPWithFB, selectAvatar, selectAnother
//SignInWalkthroughVC
case wCreateGoal, wSelectCategoryOfGoals, wTrackAchievements,
"module.login.termsAndCond" = "Terms And Cond";
"module.login.signIn" = "SIGN IN";
"module.login.signUp" = "SIGN UP";
"module.login.signUpShort" = "SIGN UP";
"module.login.email" = "Email";
"module.login.password" = "Password";
"module.login.repeatPassword" = "Repeat Password";
"module.login.signUPWithFB" = "SIGN UP WITH FACEBOOK";
"module.login.signInWithFB" = "SIGN IN WITH FACEBOOK";
"module.login.selectAvatar" = "SELECT AVATAR";
extension String {
func localized(bundle: Bundle = .main, tableName: String = "Localization") -> String {
return NSLocalizedString(self, tableName: tableName, value: "\(self)**", comment: "")
}
}
let button = AchieveMeButton(title: LoginLocalization.signInSignUp.text,
normalColor: .white,
touchColor: .lightGray,
titleColor: UIColor.amBlue())