This file contains hidden or 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
extension UIView { | |
/// secure a view to prevent it appearing in screenshots or screen recordings | |
func makeSecure() { | |
DispatchQueue.main.async { | |
let field = UITextField() | |
field.isSecureTextEntry = true | |
self.addSubview(field) | |
field.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true | |
field.centerXAnchor.constraint(equalTo: self.centerXAnchor).isActive = true |
This file contains hidden or 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 | |
public struct TextStyle: Equatable { | |
// MARK: - Instance Properties | |
public let font: UIFont? | |
public let color: UIColor? | |
public let backgroundColor: UIColor? | |
public let strikethrough: Bool | |
public let underline: Bool |
This file contains hidden or 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
///Discussion: | |
///In theory, if app is able to have visibility of a file outside the app's environment then it is jailbroken. | |
///For this test, we will be checking for common files found from various ways of jailbreaking an iOS device. | |
///As a final test: try writing outside of the app's sandbox. | |
func isJailbroken() -> Bool{ | |
#if targetEnvironment(simulator) | |
return false | |
#else | |
let fm = FileManager.default |
This file contains hidden or 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
#!/usr/bin/env python | |
import codecs | |
import optparse | |
import os | |
import re | |
""" | |
This small script extracts values from a simple key:value localization file. | |
""" |
This file contains hidden or 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
xcode-select --install | |
which -s brew | |
if [[ $? != 0 ]]; then | |
# Install Homebrew | |
sudo ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
echo "installed Homebrew" | |
else | |
sudo brew update |
This file contains hidden or 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
#!/usr/bin/env python | |
import codecs | |
import optparse | |
import os | |
import re | |
""" | |
This small script compares Cocoa / iOS development Localizable.strings files. | |
These are usually UTF-16 and difficult to compare. In addition to that, | |
the order of the contents of the files varies per export, making diff very |
This file contains hidden or 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
public static String getPath(Context context, Uri uri) { | |
final boolean needToCheckUri = Build.VERSION.SDK_INT >= 19; | |
String selection = null; | |
String[] selectionArgs = null; | |
// Uri is different in versions after KITKAT (Android 4.4), we need to | |
// deal with different Uris. | |
if (needToCheckUri && DocumentsContract.isDocumentUri(context.getApplicationContext(), uri)) { | |
if (isExternalStorageDocument(uri)) { | |
final String docId = DocumentsContract.getDocumentId(uri); | |
final String[] split = docId.split(":"); |
This file contains hidden or 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
#!/bin/bash | |
rm -rf Pods/ | |
pod cache clean --all | |
rm -rf "${HOME}/Library/Caches/CocoaPods" | |
rm -rf ~/Library/Developer/Xcode/DerivedData/* | |
pod install |