Skip to content

Instantly share code, notes, and snippets.

View embassem's full-sized avatar
🌴
On vacation

Bassem Tourky embassem

🌴
On vacation
View GitHub Profile
@AlexKobachiJP
AlexKobachiJP / XcodeCommand
Last active June 1, 2024 20:26
Sort file and package references in an Xcode project.
// Copyright © 2023 Alex Kovács. All rights reserved.
import ArgumentParser
import Foundation
import PathKit
import XcodeProj
// See below for `MainCommand` skeleton.
extension MainCommand {
struct XcodeCommand: ParsableCommand {
@lukaskubanek
lukaskubanek / Bundle+TestFlight.swift
Last active July 5, 2024 10:55
A code snippet for detecting the TestFlight environment for a macOS app at runtime
/// MIT License
///
/// Copyright (c) 2021 Lukas Kubanek, Structured Path GmbH
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
//
// CardPagingLayout.swift
//
// Created by Ahmed Fathi on 5/29/20.
// Copyright © 2020 Ahmed Fathi. All rights reserved.
//
import UIKit
class CardPagingLayout: UICollectionViewLayout {
@SergLam
SergLam / UIApplication+Environment.swift
Created January 16, 2020 18:56
Swift - check iOS app environment (debug OR TestFlight build) at runtime
import UIKit
extension UIApplication {
// MARK: Public
func isRunningInTestFlightEnvironment() -> Bool {
if isSimulator() {
return false
} else {
if isAppStoreReceiptSandbox() && !hasEmbeddedMobileProvision() {
@sukov
sukov / CodableExtension.swift
Last active November 25, 2022 17:27 — forked from mikebuss/decode-json-swift.swift
Codable (Encode & Decode) [Any] and [String: Any] Swift 5
// Original: https://gist.github.com/loudmouth/332e8d89d8de2c1eaf81875cfcd22e24
import Foundation
private struct JSONCodingKeys: CodingKey {
var stringValue: String
init(stringValue: String) {
self.stringValue = stringValue
}
@beloso
beloso / flat-swift4-noncaching.stencil
Created May 8, 2018 16:04
SwiftGen non caching Strings template
// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen
{% if tables.count > 0 %}
{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %}
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable file_length
{% macro parametersBlock types %}{% filter removeNewlines:"leading" %}
{% for type in types %}
# Customise this file, documentation can be found here:
# https://github.com/fastlane/fastlane/tree/master/fastlane/docs
# All available actions: https://docs.fastlane.tools/actions
# can also be listed using the `fastlane actions` command
# Change the syntax highlighting to Ruby
# All lines starting with a # are ignored when running `fastlane`
# If you want to automatically update fastlane if a new version is available:
# update_fastlane
@durul
durul / Xcode Defaults.md
Last active November 5, 2018 16:12
Xcode Defaults

Xcode Defaults

Command Line

# Enable internal menu
defaults write com.apple.dt.Xcode ShowDVTDebugMenu -bool YES

# Enable project build time
@malcolmkmd
malcolmkmd / UIView+Anchors.swift
Created July 10, 2017 11:16
UIView Extensions
import Foundation
import UIKit
extension UIView {
func addConstraintsWithFormat(_ format: String, views: UIView...) {
var viewsDictionary = [String: UIView]()
for (index, view) in views.enumerated() {
let key = "v\(index)"
@Gujci
Gujci / CustomTextField.swift
Last active November 16, 2022 17:42
Simple snippet how to disable actions in a UITextField
import UIKit
@IBDesignable
class CustomTextField: UITextField {
@IBInspectable var isPasteEnabled: Bool = true
@IBInspectable var isSelectEnabled: Bool = true
@IBInspectable var isSelectAllEnabled: Bool = true