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
# Bruno Rocha | |
# Add this file to your {SRCROOT}/bin, change ptProj to your desired locale | |
# and then add a Run Script at Xcode with this: | |
# ruby $SRCROOT/bin/AccountKitForceLocalization.rb | |
require 'find' | |
require 'uri' | |
require 'fileutils' | |
$scriptPath = File.dirname(__FILE__) |
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
final class MyViewController: UIViewController { | |
private let myButton: UIButton = { | |
// | |
}() | |
private let myView: UIView = { | |
// | |
}() | |
//Mais umas 10 views aqui... |
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
final class MyViewController: UIViewController { | |
let myView = MyView() | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
setupMyView() | |
} | |
private func setupMyView() { |
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
final class MyViewController: UIViewController { | |
override func loadView() { | |
let myView = MyView() | |
myView.delegate = self | |
view = myView | |
} | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
print(view) // Uma instância de 'MyView'! |
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 myView: MyView { | |
return view as! MyView | |
} |
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
/// The HasCustomView protocol defines a customView property for UIViewControllers to be used in exchange of the regular view property. | |
/// In order for this to work, you have to provide a custom view to your UIViewController at the loadView() method. | |
public protocol HasCustomView { | |
associatedtype CustomView: UIView | |
} | |
extension HasCustomView where Self: UIViewController { | |
/// The UIViewController's custom view. | |
public var customView: CustomView { | |
guard let customView = view as? CustomView else { |
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
final class MyViewController: UIViewController, HasCustomView { | |
typealias CustomView = MyView | |
override func loadView() { | |
let customView = CustomView() | |
customView.delegate = self | |
view = customView | |
} | |
override func viewDidLoad() { |
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 CustomViewController<CustomView: UIView>: UIViewController { | |
var customView: CustomView { | |
return view as! CustomView | |
} | |
override func loadView() { | |
view = CustomView() | |
} | |
} |
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
ValueDecl *DerivedConformance::deriveCaseIterable(ValueDecl *requirement) { | |
// Conformance can't be synthesized in an extension. | |
if (checkAndDiagnoseDisallowedContext(requirement)) | |
return nullptr; | |
// Check that we can actually derive CaseIterable for this type. | |
if (!canDeriveConformance(Nominal)) | |
return nullptr; | |
Type returnTy; |
OlderNewer