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
let textColorAnimation = CABasicAnimation(keyPath: "foregroundColor") | |
textColorAnimation.duration = 2.0 / 3 // duration = 30fpsのうちの約20frame | |
textColorAnimation.fromValue = Color.primaryBrand.cgColor | |
textColorAnimation.toValue = Color.black.cgColor | |
textColorAnimation.fillMode = .forwards | |
UIView.animate(withDuration: 2.0 / 3, animations: { [weak self] in | |
guard let strongSelf = self else { return } | |
strongSelf.animationText.add(textColorAnimation, forKey: "TextColor") | |
}) |
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
let transformTrans = CGAffineTransform(translationX: 0, y: -animationViewCenterMovementAmount) | |
let transformScale = CGAffineTransform(scaleX: 0.8, y: 0.8) | |
animationView.transform = transformTrans.concatenating(transformScale) |
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
let transformTrans = CGAffineTransform(translationX: 0, y: -animationViewCenterMovementAmount) | |
let transformScale = CGAffineTransform(scaleX: 0.8, y: 0.8) | |
animationView.transform = transformScale.concatenating(transformTrans) |
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
view.layoutIfNeeded() | |
animationView.play { [weak self] _ in | |
UIView.animate(withDuration: 1.0, animations: { [weak self] in | |
self?.widthConstraint.constant = 300 | |
self?.heightConstraint.constant = 300 | |
self?.view.layoutIfNeeded() | |
}) | |
} |
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
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {} |
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
// ここでは Boat_Loader.json というバンドルされたアニメーションファイルを設定 | |
let boatAnimation = LOTAnimationView(name: "Boat_Loader") | |
boatAnimation.contentMode = .scaleAspectFill | |
boatAnimation.frame = view.bounds | |
view.addSubview(boatAnimation) | |
boatAnimation.play() |
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 | |
class ViewController: UIViewController { | |
var presenter: Presenter! | |
func inject(presenter: Presenter) { | |
self.presenter = presenter | |
} | |
override func viewDidAppear(_ animated: Bool) { | |
super.viewDidAppear(animated) |
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
// まとめ | |
// ①ImplicitlyUnwrappedOptional<T>で宣言された変数に、Tに "as!" でダウンキャストした変数を代入しようとすると、「それはnilにはならない(はず)」と警告が出る | |
// ②IUOで宣言した変数にはnilが入ることを前提とした上で、利用側でnilが入らない挙動を期待する場合は!をつけるように要求する変更 | |
// ① | |
class ViewController {} | |
class PageViewController: ViewController {} |
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 XCTest | |
import KeychainAccess | |
@testable import AwesomeIOSDC | |
class AuthDataStoreTests: XCTestCase { | |
private let testAccessToken = "TestAccessToken" | |
private let accessTokenKey = "AccessToken" | |
private let keychain = Keychain(service: "TestService") | |
func testSaveAccessToken() { |
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 XCTest | |
import KeychainAccess | |
@testable import AwesomeIOSDC | |
class AuthDataStoreTests: XCTestCase { | |
let keychain = Keychain(service: Bundle.main.bundleIdentifier!) // ② | |
func testSaveAccessToken() { | |
let authDataStore = AuthDataStore() // ① | |
authDataStore.save(accessToken: "Congrats iOSDC "2018🎉") // ③, ④, ⑦ |
NewerOlder