This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class ParentViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let childVC = ChildViewController() | |
displayContentController(content: childVC) | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define the relative path to the file containing the access token | |
TOKEN_FILE_PATH="${SRCROOT}/Config/access_token.txt" | |
# Check if the file exists | |
if [ -f "$TOKEN_FILE_PATH" ]; then | |
# Read the access token from the file | |
ACCESS_TOKEN=$(cat "$TOKEN_FILE_PATH") | |
else | |
echo "Access token file not found at $TOKEN_FILE_PATH" | |
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import CryptoKit | |
struct AuthDataManager { | |
//MARK: - Encrypt/Decrypt Logic | |
/// Generate a symmetric key from a password | |
/// - Parameter password: password to use | |
/// - Returns: key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This class demostates how to extract and store payload info if it's available. Compaign ID was valuable for me so that's why only it is stored. | |
import AdServices | |
actor UTMCampaignLoader { | |
// Optional campaignID property | |
var campaignID: Int? | |
// Method to load UTM campaign asynchronously | |
func loadUTMCampaign() async -> Int? { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Setting the script | |
extension WebViewCoordinator: WKNavigationDelegate { | |
public func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { | |
let script = """ | |
function isContentFullyRendered() { | |
var imgElements = document.images; | |
var imgComplete = true; | |
for (var i = 0; i < imgElements.length; i++) { | |
if (!imgElements[i].complete) { | |
imgComplete = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//We have a UICollectionView with Grid layout that shows a collection card. | |
//Model for a card looks like this: | |
struct CollectionViewCellModel: Codable { | |
let id: Int | |
let image: String | |
let imageUrl: String | |
let name: String | |
let description: String | |
let stocksAmount: Int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ColorSliderView: View { | |
//Picked Color | |
@State | |
private var location: CGPoint = CGPoint(x: 0, y: 0) { | |
didSet { | |
//Need https://gist.githubusercontent.com/marchinram/3675efc96bf1cc2c02a5/raw/ec95113fa3cf1a6e97361426dc7574d9e14a09c0/UIImage+PixelColor.swift | |
currentColor = trackImage[Int(location.x), 0] ?? .white |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func resolveFirebaseObject<T: Codable>(_ snapshot: DocumentSnapshot) -> T? { | |
guard snapshot.exists else {return nil} | |
if let data = try? JSONSerialization.data(withJSONObject: snapshot.data(), options: []) { | |
do { | |
return try self.decoder.decode(T.self, from: data) | |
} catch { | |
print("Decoding error: \(error)") | |
} | |
} | |
return nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// FMBlurable.swift | |
// FMBlurable | |
// | |
// Created by SIMON_NON_ADMIN on 18/09/2015. | |
// Copyright © 2015 Simon Gladman. All rights reserved. | |
// | |
// Thanks to romainmenke (https://twitter.com/romainmenke) for hint on a larger sample... | |
import UIKit |
NewerOlder