This code defines a tuple with an integer status code and string message, a function that returns a tuple with status 200 and message "OK" when called, and calls that function to get the tuple and assign its values to variables. It also defines an Optional enum that can be none or contain a wrapped value.
The document shows an example of converting an external iteration over a list using a for loop into an internal iteration using Java streams. First, a for loop is used to iterate over a list of numbers and add each number multiplied by 2 to a new list. Then, this is rewritten using streams to map each number by multiplying it by 2 and collecting the results into a new list, eliminating the need for an anonymous class.
みんなで Swift 復習会での談笑用スライド – in 札幌 1st′ #minna_de_swiftTomohiro Kumagai
?
This document introduces some basic variable declarations in Swift including let constants for pi and attempts, a var variable for amount, and defines a maxCapacity constant as an Int with an initial value of 100 that is later reassigned to 20. It also declares a price constant as a Double.
This document defines various Swift variables and constants, performs printing operations, and demonstrates string interpolation. It also shows how to extend a type to conform to the CustomPlaygroundQuickLookable protocol.
The document presents an overview of using GraphQL with Swift, highlighting its advantages over REST, such as fewer round trips and the ability to request exactly the needed data. It discusses model structuring for Star Wars characters, the benefits of code generation, and emphasizes the strengthening of types in the backend schema. The speaker concludes by acknowledging the ongoing evolution of tools and best practices in integrating GraphQL with Swift for mobile applications.
This code defines a tuple with an integer status code and string message, a function that returns a tuple with status 200 and message "OK" when called, and calls that function to get the tuple and assign its values to variables. It also defines an Optional enum that can be none or contain a wrapped value.
The document shows an example of converting an external iteration over a list using a for loop into an internal iteration using Java streams. First, a for loop is used to iterate over a list of numbers and add each number multiplied by 2 to a new list. Then, this is rewritten using streams to map each number by multiplying it by 2 and collecting the results into a new list, eliminating the need for an anonymous class.
みんなで Swift 復習会での談笑用スライド – in 札幌 1st′ #minna_de_swiftTomohiro Kumagai
?
This document introduces some basic variable declarations in Swift including let constants for pi and attempts, a var variable for amount, and defines a maxCapacity constant as an Int with an initial value of 100 that is later reassigned to 20. It also declares a price constant as a Double.
This document defines various Swift variables and constants, performs printing operations, and demonstrates string interpolation. It also shows how to extend a type to conform to the CustomPlaygroundQuickLookable protocol.
The document presents an overview of using GraphQL with Swift, highlighting its advantages over REST, such as fewer round trips and the ability to request exactly the needed data. It discusses model structuring for Star Wars characters, the benefits of code generation, and emphasizes the strengthening of types in the backend schema. The speaker concludes by acknowledging the ongoing evolution of tools and best practices in integrating GraphQL with Swift for mobile applications.
11. 具体的な実装
/** 適切なタイミングで回転をハンドリング */
private func hookForRotation() {
ObjcHelper.aspect_viewControllerHookSelector("viewWillAppear:", withOptions: .PositionBefore, error: nil) { info in
let vc = info.instance() as UIViewController
self.allowRotation = vc.allowRotation
}
// 非表示時にAppDelegateのallowRotationを切り替え
ObjcHelper.aspect_navigationControllerHookSelector("popViewControllerAnimated:", withOptions: .PositionBefore,
error: nil) { info in
let vc = info.instance() as UINavigationController
let vcs = vc.viewControllers
self.allowRotation = (vcs[vcs.count - 2] as UIViewController).allowRotation
}
ObjcHelper.aspect_viewControllerHookSelector("dismissViewControllerAnimated:completion:",
withOptions: .PositionBefore, error: nil) { info in
let vc = info.instance() as UIViewController
if let presentingViewController = vc.presentingViewController {
self.allowRotation = presentingViewController.allowRotation
}
}
// supportedInterfaceOrientationsの実装をすり替え
ObjcHelper.aspect_viewControllerHookSelector("supportedInterfaceOrientations", withOptions: .PositionInstead,
error: nil) { info in
let vc = info.instance() as UIViewController
let invocation = info.originalInvocation()
var ret = Int(self.allowRotation ? UIInterfaceOrientationMask.AllButUpsideDown.rawValue :
UIInterfaceOrientationMask.Portrait.rawValue)
invocation.setReturnValue(&ret)
}
}