Skip to content

Instantly share code, notes, and snippets.

@agammahajan1
agammahajan1 / Jenkinsfile
Created September 30, 2018 19:07
Sample Jenkins Script
node {
stage('Checkout') {
checkout([$class: 'GitSCM', branches: [[name: '*/$branch']],
doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [],
userRemoteConfigs: [[credentialsId:'/$githubToken' , url: 'gihub project url']]])
}
stage('Environment/Bundles Setup') {
sh "Scripts/change_server.sh $server"
sh "pod install --repo-update"
}
@agammahajan1
agammahajan1 / Fastfile
Created September 30, 2018 19:19
Clean Xcode Fastlane Lane
lane :clean_xcode do |options|
clear_derived_data()
sh("rm -rf ProjectName*zip")
sh("rm -rf ~/Library/Developer/Xcode/Archives/*")
end
@agammahajan1
agammahajan1 / Fastfile
Created September 30, 2018 19:23
Code Sign Lane
lane :code_sign do |options|
method = "adhoc"
match(readonly: true,
type: method)
end
@agammahajan1
agammahajan1 / Fastfile
Last active October 15, 2018 10:06
Create Build Lane
lane :create_build do |options|
scheme = "ProjectName"
configuration = "Release"
export_method = "ad-hoc"
icloud_environment = "Production"
gym(scheme: scheme,
configuration: configuration,
export_options:export_options,
output_name:"ProjectName.ipa")
let image_1 = UIImage(named: "image-1")!
let image_2 = UIImage(named: "image-2")!
let image_3 = UIImage(named: "image-3")!
let images = [image_1, image_2, image_3]
let animatedImage = UIImage.animatedImage(with: images, duration: 2.0)
imageView.image = animatedImage
private func addAnimation(firstImageView: UIImageView, secondImageView: UIImageView) {
let basicAnimation1 = getBasicAnimation(withInitialPostion: centerPosition, finalPos: finalPosition)
firstImageView.layer.add(basicAnimation1, forKey: "position")
let basicAnimation2 = self.getBasicAnimation(withInitialPostion: self.initalPosition, finalPos: self.centerPosition)
secondImageView.layer.add(basicAnimation2, forKey: "position")
self.addNextImage(forImageView: firstImageView)
}
private func addAnimation(firstImageView: UIImageView, secondImageView: UIImageView) {
CATransaction.begin()
CATransaction.setCompletionBlock {
self.addNextImage(forImageView: firstImageView)
}
let basicAnimation1 = getBasicAnimation(withInitialPostion: centerPosition, finalPos: finalPosition)
firstImageView.layer.add(basicAnimation1, forKey: "position")
CATransaction.commit()
let basicAnimation2 = self.getBasicAnimation(withInitialPostion: self.initalPosition, finalPos: self.centerPosition)
private func getSpringAnimation(withInitialPostion initialPos: CGPoint, finalPos: CGPoint) -> CASpringAnimation {
let basicAnimation = CASpringAnimation(keyPath: "position")
basicAnimation.fromValue = NSValue(cgPoint: initialPos)
basicAnimation.toValue = NSValue(cgPoint: finalPos)
basicAnimation.duration = basicAnimation.settlingDuration
basicAnimation.damping = 14
basicAnimation.initialVelocity = 5
basicAnimation.isRemovedOnCompletion = false
basicAnimation.fillMode = CAMediaTimingFillMode.forwards
return basicAnimation
private let colorArray = ["FBDA75", "FFCCAC", "FFD4E4", "DCDEF9"]
private let imageArray = ["image-1", "image-2", "image-3", "image-4"]
private var timer: Timer?
private var iconsInterval: Int = 0
// for image animation
private var imageView1: UIImageView!
private var imageView2: UIImageView!
private var imageViewChangeflag = 1
private var initalPosition: CGPoint!
func addAnimation(firstImageView: UIImageView, secondImageView: UIImageView) {
let basicAnimation1 = getBasicAnimation(withInitialPostion: centerPosition, finalPos: finalPosition)
firstImageView.layer.add(basicAnimation1, forKey: "position")
let basicAnimation2 = self.getBasicAnimation(withInitialPostion: self.initalPosition, finalPos: self.centerPosition)
secondImageView.layer.add(basicAnimation2, forKey: "position")
self.addNextImage(forImageView: firstImageView)
}
func getBasicAnimation(withInitialPostion initialPos: CGPoint, finalPos: CGPoint) -> CABasicAnimation {
let basicAnimation = CABasicAnimation(keyPath: "position")
basicAnimation.fromValue = NSValue(cgPoint: initialPos)