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
Code review | |
12: MusicAlbum struct need to confirm Decodable protocol to decode response from url request | |
25: Initializer need to have albums initialized with default value like init(albums: [MusicAlbum] = [MusicAlbum]()) | |
29: Function name should be in camel case instead of snake case | |
30: Url needs to be a valid format, otherwise url session will fail to load response | |
33: Before sink, we need make sure to publish values from main thread using .received(on: DispatchQueue.main) | |
34: Need to check completion with .finished and .failure case to show appropriate error message if exists. | |
37: After line 37, we need to store cancellables instance in specified collection | |
45: showDetailView needs to be a @State property, otherwise we can’t change it’s value inside struct |
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 | |
// Linked List (Insert, Delete, Special insert) | |
class Node { | |
let value: Int | |
var nextNode: Node? | |
init(value:Int, nextNode: Node?) { | |
self.value = value | |
self.nextNode = nextNode |
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 | |
var string = "1337" | |
func convert(string: String) -> Int? { | |
var total = 0 | |
let valueMap = [ | |
"0" as Character : 0, | |
"1" : 1, |
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 UIApplication { | |
class func topViewController(base: UIViewController? = UIApplication.sharedApplication().keyWindow?.rootViewController) -> UIViewController? { | |
if let nav = base as? UINavigationController { | |
return topViewController(base: nav.visibleViewController) | |
} | |
if let tab = base as? UITabBarController { | |
if let selected = tab.selectedViewController { | |
return topViewController(base: selected) | |
} | |
} |
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
//: Playground - noun: a place where people can play | |
import UIKit | |
print("Object Oriented Programming") | |
// Protocal | |
protocol PurchaseItem { | |
func cost() -> Float |
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
var PDF = require('bencoding.pdf'); | |
var converters = PDF.createConverters(); | |
var win = Ti.UI.createWindow({ backgroundColor:'#fff'}); | |
var vwContent = Ti.UI.createView({ | |
top:0, layout:'vertical' | |
}); | |
win.add(vwContent); | |
vwContent.add(Ti.UI.createView({ |
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
var win = Ti.UI.createWindow(); | |
var loaderImage = Ti.UI.createImageView({ | |
width:150, | |
height:150 | |
}); | |
// set the length of the images you have in your sequence | |
var loaderArrayLength=3; | |
// initialize the index to 1 |
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
var win = Ti.UI.createWindow({ | |
fullscreen: true, | |
backgroundColor: 'blue', | |
}); | |
setInterval(function(){ | |
var backColor = win.backgroundColor; | |
if(backColor == 'blue'){ | |
win.animate({backgroundColor: 'purple', duration: 1500}); | |
win.backgroundColor = 'purple'; |
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
var win = Ti.UI.createWindow({ | |
backgroundColor : '#000', | |
layout:'vertical' | |
}); | |
var mp3_array = []; | |
mp3_array.push('music/sound1.mp3'); | |
mp3_array.push('music/sound2.mp3'); | |
mp3_array.push('music/sound3.mp3'); |
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
var win = Ti.UI.createWindow({backgroundColor : 'white'}); | |
var txtFld = Ti.UI.createTextField({ | |
height : 40, | |
width : 120, | |
backgroundColor : 'gray' | |
}); | |
win.add(txtFld); | |
var numLbl = Ti.UI.createLabel({ |
NewerOlder