Installation procedure for pre-build actions to automatically populate Xcode Info.plist with dynamic data.
Edit Xcode Scheme and add a pre-action script.
Copy the contents of preaction.sh
into the pre-action script box.
#!/usr/bin/env python | |
import re | |
pattern = '.*<(iframe|param).*(src|value)="(?P<link>http://www.youtube.com/(embed|v)/[a-zA-Z0-9/\.\?&;=\+_-]+);?.*".*>.*</(iframe|param)>.*' | |
action = re.compile(pattern) | |
result = action.findall('<div><iframe.....></iframe><param......></param></div>') | |
print result |
#!/bin/bash | |
# Link: <https://gist.github.com/jellybeansoup/db7b24fb4c7ed44030f4> | |
# | |
# A command-line script for incrementing build numbers for all known targets in an Xcode project. | |
# | |
# This script has two main goals: firstly, to ensure that all the targets in a project have the | |
# same CFBundleVersion and CFBundleShortVersionString values. This is because mismatched values | |
# can cause a warning when submitting to the App Store. Secondly, to ensure that the build number | |
# is incremented appropriately when git has changes. | |
# |
// | |
// Created by Volodymyr Andriienko on 18.05.2021. | |
// Copyright © 2021 VAndrJ. All rights reserved. | |
// | |
#if DEBUG | |
#if canImport(SwiftUI) | |
import SwiftUI | |
@available (iOS 13.0, *) |
Installation procedure for pre-build actions to automatically populate Xcode Info.plist with dynamic data.
Edit Xcode Scheme and add a pre-action script.
Copy the contents of preaction.sh
into the pre-action script box.
In order for agvtool to work properly you must first set
Project Settings / Build Settings / Versioning / Versioning System to Apple Generic.
import Foundation | |
import class UIKit.UIImage | |
struct AttributedString: ExpressibleByStringInterpolation { | |
enum Attribute: Hashable { | |
enum ImportanceLevel: String, Equatable { | |
case very | |
case enough | |
} | |
case important(ImportanceLevel = .enough) |
import Foundation | |
/// A class that keeps a weakly reference for `self` when implementing `onXXX` behaviors. | |
/// Instead of remembering to keep `self` as weak in a stored closure: | |
/// | |
/// ```swift | |
/// // MyClass.swift | |
/// var onDone: (() -> Void)? | |
/// func done() { | |
/// onDone?() |
import Foundation | |
// MARK: - typed predicate types | |
public protocol TypedPredicateProtocol: NSPredicate { associatedtype Root } | |
public final class CompoundPredicate<Root>: NSCompoundPredicate, TypedPredicateProtocol {} | |
public final class ComparisonPredicate<Root>: NSComparisonPredicate, TypedPredicateProtocol {} | |
// MARK: - compound operators |
import WebKit | |
class NativeWebViewController: UIViewController { | |
let viewportScriptString = "var meta = document.createElement('meta'); meta.setAttribute('name', 'viewport'); meta.setAttribute('content', 'width=device-width'); meta.setAttribute('initial-scale', '1.0'); meta.setAttribute('maximum-scale', '1.0'); meta.setAttribute('minimum-scale', '1.0'); meta.setAttribute('user-scalable', 'no'); document.getElementsByTagName('head')[0].appendChild(meta);" | |
let disableSelectionScriptString = "document.documentElement.style.webkitUserSelect='none';" | |
let disableCalloutScriptString = "document.documentElement.style.webkitTouchCallout='none';" | |
override func viewDidLoad() { | |
// 1 - Make user scripts for injection |
// | |
// LayoutThatFits.swift | |
// WWDC22Experiments | |
// | |
// Created by Ryan Lintott on 2022-06-08. | |
// | |
import SwiftUI | |
struct LayoutThatFits: Layout { |