Skip to content

Instantly share code, notes, and snippets.

View mariia-cherniuk's full-sized avatar

Mariia Cherniuk mariia-cherniuk

  • London, United Kingdom
View GitHub Profile
@mariia-cherniuk
mariia-cherniuk / IfLetElseView.swift
Last active May 27, 2020 15:24
Nice little utility view that allows you handle optional values in your SwiftUI views
import SwiftUI
@available(iOS 13.0, *)
public struct IfLetElseView<Value, IfContent: View, ElseContent: View>: View {
private let value: Value?
private let ifContent: (Value) -> IfContent
private let elseContent: () -> ElseContent
public init(_ value: Value?,
@ViewBuilder ifContent: @escaping (Value) -> IfContent,
module Fastlane
module Actions
class CheckoutBranchForJiraIssueAction < Action
def self.run(params)
key = params[:key].split('/').last
branch_name = self.branch_name(key)
branch = "#{key}_#{branch_name}"
sh "git fetch"
ref_count = sh "git show-ref refs/remotes/origin/#{branch} | wc -l"
submit-appstore:
only:
refs:
- develop
needs: [deliver-appstore]
stage: submit-appstore
tags: [osx]
allow_failure: false
script:
- bundle exec fastlane submit_app
desc "Submit app"
lane :submit_app do
deliver(
build_number: "latest",
skip_metadata: true,
skip_screenshots: true,
skip_binary_upload: true,
force: true,
submit_for_review: true,
phased_release: true,
desc "Fetches the provisioning profiles so you can build locally and deploy to your device"
lane :certificates do
match(type: "development", app_identifier: ["your_app_identifier"])
match(type: "adhoc", app_identifier: ["your_app_identifier"])
match(type: "appstore", app_identifier: ["your_app_identifier"])
end
desc "Merges develop into your feature branch \"Pre-push git hook\""
lane :merge_develop_if_needed do
current_branch = Actions.sh("git rev-parse --abbrev-ref HEAD")
next unless current_branch.start_with?(ENV['JIRA_PROJECT'])
Actions.sh("git fetch && git merge origin/#{ENV['DEVELOP_BRANCH']} --no-edit")
end
desc "Create and checkout git branch for a JIRA ticket"
lane :checkout do |options|
ticket = options[:ticket]
if !ticket
ticket = prompt(text: "JIRA ticket key e.g. AMI-XYZ: ")
end
checkout_branch_for_jira_issue(key: ticket)
end
unit-tests:
only:
- external_pull_requests
stage: unit-tests
tags: [osx]
script:
- bundle exec fastlane pull_request
artifacts:
when: always
paths:
desc "Runs pull request workflow \"Open a pull request\""
lane :pull_request do
scan(scheme: "Pull Request", skip_build: true)
end
desc "Runs all the regression UI Tests"
lane :regression do
scan(scheme: "UAT Regression", skip_build: true)
end