Skip to content

Commit 443f375

Browse files
Merge pull request #175 from teads/swiftformat_support
2 parents c7c414e + 9d23408 commit 443f375

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

Lines changed: 13 additions & 0 deletions
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

Lines changed: 4 additions & 5 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 5 additions & 1 deletion
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

Lines changed: 19 additions & 0 deletions
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

Lines changed: 7 additions & 8 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 13 additions & 22 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 4 deletions
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
}

0 commit comments

Comments
 (0)