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 | |
import PlaygroundSupport | |
//to run serial queue in playground always make the following true | |
PlaygroundPage.current.needsIndefiniteExecution = true | |
let mainQueue = DispatchQueue.main | |
let globalQueue = DispatchQueue.global() | |
let serialQueue = DispatchQueue(label: "net.ithinkdiff.app") | |
let concurQueue = DispatchQueue(label: "net.ithinkdiff.app.concurr", attributes: .concurrent) |
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
var score:Int? | |
score = 100 | |
//if score is nil the if block will not work | |
/*if score has value, the if block create a new constant score and assign the score value to the new constant score which is unwrapped and available within the if block | |
*/ | |
if let score = score{ | |
score | |
} | |
score ?? 0 //provide a default value when there is nil | |
score! //when u sure the optional must have a value other than 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
var x // error | |
var x:Int // okay |
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
class Properties{ | |
static let sharedInstance = Properties() | |
private let userDefaults:UserDefaults = UserDefaults() | |
var fontSize:Double = 10.0{ | |
didSet{ | |
userDefaults.setValue(fontSize, forKey: "FONT_SIZE") | |
userDefaults.synchronize() | |
print("Font Size Saved") | |
} |
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
#!/usr/bin/ruby | |
#XCode modification | |
require 'xcodeproj' | |
bundleId = ARGV[0] | |
path = ARGV[1] | |
project_path = path + "/XCodeProject.xcodeproj" | |
puts(project_path) |
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
def modifyXCodeProjByRuby(bundleIdentifier, path): | |
print("XCode Project Modified by Ruby") | |
rubyModifyCommand = "ruby RUBY_FILE_NAME.rb " + "\"" + bundleIdentifier + "\"" + " " + "\"" + path + "\"" | |
print(rubyModifyCommand) | |
os.system(rubyModifyCommand) |
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 os | |
import shutil | |
import subprocess | |
import plistlib |
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
try: | |
removeIcons = "/app_directory/app_name/Images.xcassets/AppIcon.appiconset" | |
shutil.rmtree(removeIcons) | |
print("Icons deleted") | |
except: | |
print("ERROR: Icons not found") |
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 errno | |
import shutil | |
def copy(src, dest): | |
try: | |
shutil.copytree(src, dest) | |
except OSError as e: | |
# If the error was caused because the source wasn't a directory | |
if e.errno == errno.ENOTDIR: | |
shutil.copy(src, dest) |
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
def pListModification(): | |
bundleName = "MY APP" | |
bundleIdentifier = "net.myapp" | |
plistNote ="app_directory/app_name/" + "/App/App-Info.plist" | |
plistNoteData = plistlib.readPlist(plistNote) | |
plistNoteData['CFBundleDisplayName'] = "New My App" |
OlderNewer