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
struct ErrorView : View { | |
var body: some View { | |
ScrollView { | |
VStack { | |
ScrollView { | |
ForEach(0..<100) { _ in | |
Text("test") | |
} | |
} .frame(width: 300, height: 500) |
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
struct ErrorView : View { | |
var body: some View { | |
ScrollView { | |
VStack { | |
ScrollView { | |
Text("test") | |
} | |
} | |
} |
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 control = PageControl(categories: [.settings, .settings, .settings, .settings, .settings]) | |
// ViewPager is another class that basically wraps a UIScrollView, saving that one for the next article :D | |
let viewExpand = ViewPager(views: [pagerView(.red), pagerView(.blue), pagerView(.green), pagerView(.yellow), pagerView(.black)]) | |
control.delegate = viewExpand | |
control.selectIndex(0) | |
view.addSubview(control.stack!) |
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
enum ViewCategory : String { | |
case home = "home" | |
case info = "info" | |
case settings = "settings" | |
case interests = "interests" | |
func button() -> UIButton { | |
let button = UIButton() | |
button.setImage(UIImage(named:rawValue), for: .normal) |
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
struct UserResponse { | |
var _id : String | |
var first_name : String | |
var last_name : String | |
init(JSON: [String : AnyObject]) { | |
_id = JSON["_id"] as! String | |
first_name = JSON["first_name"] as! String | |
last_name = JSON["last_name"] as! String | |
} |
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
class Client { | |
var baseURL = "http://dev.whatever.com/" | |
func execute(request : Request, completionHandler: (Response<AnyObject, NSError>) -> Void){ | |
Alamofire.request(request.method, baseURL + request.path, parameters: request.parameters()) | |
.responseJSON { response in | |
completionHandler(response) | |
} | |
} | |
} |
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 Alamofire | |
protocol Request { | |
var path : String { get } | |
var method : Method { get } | |
func parameters() -> [String : AnyObject] | |
} | |
struct AuthRequest : Request { | |
let path = "auth" |
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
{"data":{"pricingTiers":[{"tierStem":"0","tierName":"Free","pricingInfo":[{"country":"United States","countryCode":"US","currencySymbol":"$","currencyCode":"USD","wholesalePrice":0.00,"retailPrice":0.00,"fRetailPrice":"$0.00","fWholesalePrice":"$0.00"},{"country":"Canada","countryCode":"CA","currencySymbol":"$","currencyCode":"CAD","wholesalePrice":0.00,"retailPrice":0.00,"fRetailPrice":"$0.00","fWholesalePrice":"$0.00"},{"country":"Mexico","countryCode":"MX","currencySymbol":"$","currencyCode":"MXN","wholesalePrice":0.00,"retailPrice":0.00,"fRetailPrice":"$0.00","fWholesalePrice":"$0.00"},{"country":"Australia","countryCode":"AU","currencySymbol":"$","currencyCode":"AUD","wholesalePrice":0.00,"retailPrice":0.00,"fRetailPrice":"$0.00","fWholesalePrice":"$0.00"},{"country":"New Zealand","countryCode":"NZ","currencySymbol":"$","currencyCode":"NZD","wholesalePrice":0.00,"retailPrice":0.00,"fRetailPrice":"$0.00","fWholesalePrice":"$0.00"},{"country":"Japan","countryCode":"JP","currencySymbol":"¥","currencyCode":" |
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
enum UIStackViewAlignment : Int { | |
case Fill | |
case Leading | |
static var Top: UIStackViewAlignment { get { return .Leading} } | |
case FirstBaseline | |
case Center | |
case Trailing | |
static var Bottom: UIStackViewAlignment { get{ return .Trailing} } | |
case LastBaseline | |
} |
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
enum UIStackViewDistribution : Int { | |
case Fill | |
case FillEqually | |
case FillProportionally | |
case EqualSpacing | |
case EqualCentering | |
} |