Skip to content

Commit 9d23408

Browse files
committed
format source with swiftformat
1 parent c7c414e commit 9d23408

File tree

46 files changed

+951
-1062
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+951
-1062
lines changed

.swiftformat

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# rules
2+
--disable wrapMultilineStatementBraces
3+
4+
# format options
5+
--elseposition same-line
6+
--guardelse same-line
7+
--redundanttype inferred
8+
--indentcase true
9+
--ifdef no-indent
10+
--operatorfunc no-space
11+
--wraparguments before-first
12+
--wrapparameters before-first
13+
--wrapcollections before-first

Package.swift

+4-5
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,22 @@ let omModuleName = "OMSDK_Teadstv"
88
let package = Package(
99
name: teadsModuleName,
1010
platforms: [
11-
.iOS(.v10)
11+
.iOS(.v10),
1212
],
1313
products: [
1414
.library(
1515
name: teadsModuleName,
1616
targets: [teadsModuleName, omModuleName]
17-
)
17+
),
1818
],
1919
targets: [
2020
.binaryTarget(
2121
name: teadsModuleName,
2222
path: "Frameworks/\(teadsModuleName).xcframework"
2323
),
2424
.binaryTarget(
25-
name: omModuleName,
26-
path: "Frameworks/\(omModuleName).xcframework"
25+
name: omModuleName,
26+
path: "Frameworks/\(omModuleName).xcframework"
2727
),
28-
2928
]
3029
)

Podfile

+2
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ target 'TeadsSampleApp' do
1414
pod 'TeadsAdMobAdapter', '~> 5.0'
1515
pod 'TeadsAppLovinAdapter', '~> 5.0'
1616

17+
18+
pod 'SwiftFormat/CLI'
1719
end

Podfile.lock

+5-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ PODS:
5858
- Smart-Core-SDK (7.17.0)
5959
- Smart-Display-SDK (7.17.0):
6060
- Smart-Core-SDK (~> 7.17)
61+
- SwiftFormat/CLI (0.49.6)
6162
- TeadsAdMobAdapter (5.0.12):
6263
- Google-Mobile-Ads-SDK (>= 8.0)
6364
- TeadsSDK (= 5.0.12)
@@ -75,6 +76,7 @@ PODS:
7576
- TeadsSDK/Core (5.0.12)
7677

7778
DEPENDENCIES:
79+
- SwiftFormat/CLI
7880
- TeadsAdMobAdapter (~> 5.0)
7981
- TeadsAppLovinAdapter (~> 5.0)
8082
- TeadsMoPubAdapter (~> 5.0)
@@ -93,6 +95,7 @@ SPEC REPOS:
9395
- PromisesObjC
9496
- Smart-Core-SDK
9597
- Smart-Display-SDK
98+
- SwiftFormat
9699
- TeadsAdMobAdapter
97100
- TeadsAppLovinAdapter
98101
- TeadsMoPubAdapter
@@ -110,12 +113,13 @@ SPEC CHECKSUMS:
110113
PromisesObjC: 68159ce6952d93e17b2dfe273b8c40907db5ba58
111114
Smart-Core-SDK: 2f7ace8d71315cb2d864ada9c756f2d1d36d5c11
112115
Smart-Display-SDK: bdd450cda22cbcd0e3552c43ee6eeaf82c5df19d
116+
SwiftFormat: e40542bcf76fdaa006d0dc26a9ca8278ca028d76
113117
TeadsAdMobAdapter: 9d09a6c2abe708fa2701dc155995deaa294674bb
114118
TeadsAppLovinAdapter: 5d37ef8e81ceb348d73e09ced31e30510cb4e9d7
115119
TeadsMoPubAdapter: e5cd6b2b1670e73819fa8a8629594880d7b1c0c0
116120
TeadsSASAdapter: da05523d13255a7273a610d9c095f21b22b122dc
117121
TeadsSDK: 3c5f5ab6bc71a88efe998f86182add7fa595d4fd
118122

119-
PODFILE CHECKSUM: 42f5828869ba5c98c85b09681c455747029b247d
123+
PODFILE CHECKSUM: 99a356118f86a5d47afc67af3c320f74dd36e3fd
120124

121125
COCOAPODS: 1.11.2

TeadsSampleApp.xcodeproj/project.pbxproj

+19
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,7 @@
567567
buildConfigurationList = B5555A441F7CDF80007406D4 /* Build configuration list for PBXNativeTarget "TeadsSampleApp" */;
568568
buildPhases = (
569569
30717AAFC9E6D6D8951DDAD6 /* [CP] Check Pods Manifest.lock */,
570+
E96C1F9B27E495D900151530 /* SwiftFormat */,
570571
B5555A2E1F7CDF80007406D4 /* Sources */,
571572
B5555A2F1F7CDF80007406D4 /* Frameworks */,
572573
B5555A301F7CDF80007406D4 /* Resources */,
@@ -755,6 +756,24 @@
755756
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-TeadsSampleApp/Pods-TeadsSampleApp-resources.sh\"\n";
756757
showEnvVarsInLog = 0;
757758
};
759+
E96C1F9B27E495D900151530 /* SwiftFormat */ = {
760+
isa = PBXShellScriptBuildPhase;
761+
buildActionMask = 2147483647;
762+
files = (
763+
);
764+
inputFileListPaths = (
765+
);
766+
inputPaths = (
767+
);
768+
name = SwiftFormat;
769+
outputFileListPaths = (
770+
);
771+
outputPaths = (
772+
);
773+
runOnlyForDeploymentPostprocessing = 0;
774+
shellPath = /bin/sh;
775+
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n\"${PODS_ROOT}/SwiftFormat/CommandLineTool/swiftformat\" \"$SRCROOT\"\n";
776+
};
758777
/* End PBXShellScriptBuildPhase section */
759778

760779
/* Begin PBXSourcesBuildPhase section */

TeadsSampleApp/AppDelegate.swift

+7-8
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@
66
// Copyright © 2018 Teads. All rights reserved.
77
//
88

9-
import UIKit
109
import TeadsSDK
10+
import UIKit
1111

1212
@UIApplicationMain
1313
class AppDelegate: UIResponder, UIApplicationDelegate {
14-
1514
var window: UIWindow?
1615

17-
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
16+
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
1817
Teads.configure()
1918
let launchedBefore = UserDefaults.standard.bool(forKey: "launchedBefore")
2019
if !launchedBefore {
@@ -25,26 +24,26 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
2524
return true
2625
}
2726

28-
func applicationWillResignActive(_ application: UIApplication) {
27+
func applicationWillResignActive(_: UIApplication) {
2928
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call
3029
// or SMS message) or when the user quits the application and it begins the transition to the background state.
3130
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
3231
}
3332

34-
func applicationDidEnterBackground(_ application: UIApplication) {
33+
func applicationDidEnterBackground(_: UIApplication) {
3534
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
3635
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
3736
}
3837

39-
func applicationWillEnterForeground(_ application: UIApplication) {
38+
func applicationWillEnterForeground(_: UIApplication) {
4039
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
4140
}
4241

43-
func applicationDidBecomeActive(_ application: UIApplication) {
42+
func applicationDidBecomeActive(_: UIApplication) {
4443
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
4544
}
4645

47-
func applicationWillTerminate(_ application: UIApplication) {
46+
func applicationWillTerminate(_: UIApplication) {
4847
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
4948
}
5049
}

TeadsSampleApp/Cells/AdmobNativeAdTableViewCell.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
// Created by Jérémy Grosjean on 16/06/2021.
66
//
77

8-
import UIKit
98
import GoogleMobileAds
9+
import UIKit
1010

1111
class AdmobNativeAdTableViewCell: UITableViewCell {
12-
@IBOutlet weak var nativeAdView: GADNativeAdView!
12+
@IBOutlet var nativeAdView: GADNativeAdView!
1313
}

TeadsSampleApp/Cells/FakeArticleNativeTableViewCell.swift

+13-22
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import UIKit
99

1010
@objc protocol FakeNativeCell {
11-
1211
var mediaView: UIImageView! { get }
1312
var iconImageView: UIImageView! { get }
1413
var titleLabel: UILabel! { get }
@@ -18,48 +17,40 @@ import UIKit
1817
}
1918

2019
extension FakeNativeCell {
21-
2220
func setMockValues() {
2321
mediaView.image = UIImage(named: "social-covers")
2422
iconImageView.image = UIImage(named: "teads-logo")
2523
titleLabel.text = "Teads"
2624
contentLabel.text = "The global media platform"
2725
callToActionButton.setTitle("Discover", for: .normal)
28-
callToActionButton.addTarget(self, action: #selector(self.openTeadsWebsite), for: .touchUpInside)
26+
callToActionButton.addTarget(self, action: #selector(openTeadsWebsite), for: .touchUpInside)
2927
}
30-
3128
}
3229

3330
class FakeArticleNativeTableViewCell: UITableViewCell, FakeNativeCell {
34-
35-
@IBOutlet weak var mediaView: UIImageView!
36-
@IBOutlet weak var iconImageView: UIImageView!
37-
@IBOutlet weak var titleLabel: UILabel!
38-
@IBOutlet weak var contentLabel: UILabel!
39-
@IBOutlet weak var callToActionButton: UIButton!
40-
31+
@IBOutlet var mediaView: UIImageView!
32+
@IBOutlet var iconImageView: UIImageView!
33+
@IBOutlet var titleLabel: UILabel!
34+
@IBOutlet var contentLabel: UILabel!
35+
@IBOutlet var callToActionButton: UIButton!
36+
4137
@objc func openTeadsWebsite() {
4238
if let url = URL(string: "https://teads.com") {
4339
UIApplication.shared.open(url)
4440
}
4541
}
46-
4742
}
4843

49-
5044
class FakeArticleNativeCollectionViewCell: UICollectionViewCell, FakeNativeCell {
51-
52-
@IBOutlet weak var mediaView: UIImageView!
53-
@IBOutlet weak var iconImageView: UIImageView!
54-
@IBOutlet weak var titleLabel: UILabel!
55-
@IBOutlet weak var contentLabel: UILabel!
56-
@IBOutlet weak var callToActionButton: UIButton!
57-
45+
@IBOutlet var mediaView: UIImageView!
46+
@IBOutlet var iconImageView: UIImageView!
47+
@IBOutlet var titleLabel: UILabel!
48+
@IBOutlet var contentLabel: UILabel!
49+
@IBOutlet var callToActionButton: UIButton!
50+
5851
@objc func openTeadsWebsite() {
5952
if let url = URL(string: "https://teads.com") {
6053
UIApplication.shared.open(url)
6154
}
6255
}
63-
6456
}
65-

TeadsSampleApp/Cells/NativeAdCollectionViewCell.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
// Copyright © 2021 Teads. All rights reserved.
77
//
88

9-
import UIKit
109
import TeadsSDK
10+
import UIKit
1111

1212
class NativeAdCollectionViewCell: UICollectionViewCell {
13-
@IBOutlet weak var adView: TeadsNativeAdView!
13+
@IBOutlet var adView: TeadsNativeAdView!
1414
}

TeadsSampleApp/Cells/NativeAdTableViewCell.swift

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
// Created by Thibaud Saint-Etienne on 02/12/2020.
66
//
77

8-
import UIKit
98
import TeadsSDK
9+
import UIKit
1010

1111
class NativeAdTableViewCell: UITableViewCell {
12-
13-
@IBOutlet weak var adView: TeadsNativeAdView!
14-
12+
@IBOutlet var adView: TeadsNativeAdView!
1513
}

TeadsSampleApp/Cells/NativeTableViewCell.swift

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,5 @@
88
import UIKit
99

1010
class NativeTableViewCell: UITableViewCell {
11-
12-
@IBOutlet weak var nativeAdView: UIView!
13-
11+
@IBOutlet var nativeAdView: UIView!
1412
}

TeadsSampleApp/Controllers/InRead/Admob/ScrollView/InReadAdmobScrollViewController.swift

+22-27
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,17 @@ import TeadsSDK
1111
import UIKit
1212

1313
class InReadAdmobScrollViewController: TeadsViewController {
14-
1514
var bannerView: GAMBannerView!
16-
@IBOutlet weak var slotView: UIView!
17-
@IBOutlet weak var slotViewHeightConstraint: NSLayoutConstraint!
18-
15+
@IBOutlet var slotView: UIView!
16+
@IBOutlet var slotViewHeightConstraint: NSLayoutConstraint!
17+
1918
override func viewDidLoad() {
2019
super.viewDidLoad()
2120

2221
// 1. Create AdMob view and add it to hierarchy
2322
bannerView = GAMBannerView(adSize: GADAdSizeFluid)
2423
slotView.addSubview(bannerView)
25-
24+
2625
bannerView.translatesAutoresizingMaskIntoConstraints = false
2726
bannerView.centerXAnchor.constraint(equalTo: slotView.centerXAnchor).isActive = true
2827
bannerView.centerYAnchor.constraint(equalTo: slotView.centerYAnchor).isActive = true
@@ -33,65 +32,61 @@ class InReadAdmobScrollViewController: TeadsViewController {
3332
bannerView.delegate = self
3433

3534
// 3. Load a new ad (this will call AdMob and Teads afterward)
36-
let adSettings = TeadsAdapterSettings { (settings) in
35+
let adSettings = TeadsAdapterSettings { settings in
3736
settings.enableDebug()
3837
try? settings.registerAdView(bannerView, delegate: self)
3938
// Needed by european regulation
4039
// See https://mobile.teads.tv/sdk/documentation/ios/gdpr-consent
41-
//settings.userConsent(subjectToGDPR: "1", consent: "0001100101010101")
42-
40+
// settings.userConsent(subjectToGDPR: "1", consent: "0001100101010101")
41+
4342
// The article url if you are a news publisher
44-
//settings.pageUrl("http://page.com/article1")
43+
// settings.pageUrl("http://page.com/article1")
4544
}
46-
45+
4746
let customEventExtras = GADMAdapterTeads.customEventExtra(with: adSettings)
48-
47+
4948
let request = GADRequest()
5049
request.register(customEventExtras)
51-
50+
5251
bannerView.load(request)
5352
}
54-
53+
5554
private func resizeAd(height: CGFloat) {
5655
slotViewHeightConstraint.constant = height
5756
bannerView.resize(GADAdSizeFromCGSize(CGSize(width: slotView.frame.width, height: height)))
5857
}
59-
6058
}
6159

6260
extension InReadAdmobScrollViewController: GADBannerViewDelegate {
63-
64-
func bannerViewDidReceiveAd(_ bannerView: GADBannerView) {
61+
func bannerViewDidReceiveAd(_: GADBannerView) {
6562
// not used
6663
}
67-
64+
6865
/// Tells the delegate an ad request failed.
69-
func bannerView(_ bannerView: GADBannerView, didFailToReceiveAdWithError error: Error) {
66+
func bannerView(_: GADBannerView, didFailToReceiveAdWithError error: Error) {
7067
resizeAd(height: 0)
7168
print("adView:didFailToReceiveAdWithError: \(error.localizedDescription)")
7269
}
73-
70+
7471
/// Tells the delegate that a full-screen view will be presented in response
7572
/// to the user clicking on an ad.
76-
func bannerViewWillPresentScreen(_ bannerView: GADBannerView) {
73+
func bannerViewWillPresentScreen(_: GADBannerView) {
7774
// not used
7875
}
79-
76+
8077
/// Tells the delegate that the full-screen view will be dismissed.
81-
func bannerViewWillDismissScreen(_ bannerView: GADBannerView) {
78+
func bannerViewWillDismissScreen(_: GADBannerView) {
8279
// not used
8380
}
84-
81+
8582
/// Tells the delegate that the full-screen view has been dismissed.
86-
func bannerViewDidDismissScreen(_ bannerView: GADBannerView) {
83+
func bannerViewDidDismissScreen(_: GADBannerView) {
8784
// not used
8885
}
89-
9086
}
9187

9288
extension InReadAdmobScrollViewController: TeadsMediatedAdViewDelegate {
93-
94-
func didUpdateRatio(_ adView: UIView, adRatio: TeadsAdRatio) {
89+
func didUpdateRatio(_: UIView, adRatio: TeadsAdRatio) {
9590
resizeAd(height: adRatio.calculateHeight(for: slotView.frame.width))
9691
}
9792
}

0 commit comments

Comments
 (0)