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
| [self.KVOController observe:self | |
| keyPath:NSStringFromSelector(@selector(observeObjectName)) | |
| options:NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew | |
| block:^(id _Nullable observer, id _Nonnull object, NSDictionary<NSString *,id> * _Nonnull change) { | |
| //do something | |
| }]; |
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
| dismiss(animated: true, completion: nil) |
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
| func testAsyncFunction() { | |
| let exp = expectation(description: "Async Expectation") | |
| NetworkManager.shared.update(data: Data(), completeHandler: { | |
| exp.fulfill() | |
| }) | |
| waitForExpectations(timeout: 30, handler: nil) | |
| } |
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 | |
| struct UISetting { | |
| static let blue = UIColor(colorLiteralRed: 21/255, green: 122/255, blue: 251/255, alpha: 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
| func setUpView() { | |
| let loginButton = CircleButton() | |
| loginButton.backgroundColor = UISetting.blue | |
| } |
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
| pod 'Firebase/AdMob' |
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 Firebase | |
| import GoogleMobileAds | |
| func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
| FirebaseApp.configure() | |
| GADMobileAds.configure(withApplicationID: Your_Ads_ApplicationID) | |
| return true | |
| } |
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
| func loadAdMob() { | |
| GADRewardBasedVideoAd.sharedInstance().delegate = self | |
| let request = GADRequest() | |
| GADRewardBasedVideoAd.sharedInstance().load(request, withAdUnitID: AdUnitID) | |
| } |
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
| if GADRewardBasedVideoAd.sharedInstance().isReady { | |
| GADRewardBasedVideoAd.sharedInstance().present(fromRootViewController: self) | |
| } else { | |
| //do something | |
| } |
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
| func rewardBasedVideoAd(_ rewardBasedVideoAd: GADRewardBasedVideoAd, didRewardUserWith reward: GADAdReward) { | |
| //give user reward | |
| } | |
| func rewardBasedVideoAd(_ rewardBasedVideoAd: GADRewardBasedVideoAd, didFailToLoadWithError error: Error) { | |
| print("Reward based video ad failed to load: \(error.localizedDescription)") | |
| } | |
| func rewardBasedVideoAdDidReceive(_ rewardBasedVideoAd: GADRewardBasedVideoAd) { | |
| print("Reward based video ad is received.") |