瀏覽代碼

add codeformat(swiftformat)

wenweiwei 3 年之前
父節點
當前提交
58b4ae4323

+ 65 - 0
.swiftformat

@@ -0,0 +1,65 @@
+--allman false
+--assetliterals visual-width
+--beforemarks 
+--binarygrouping none
+--categorymark "MARK: %c"
+--classthreshold 0
+--closingparen balanced
+--commas always
+--conflictmarkers reject
+--decimalgrouping none
+--elseposition same-line
+--enumthreshold 0
+--exponentcase lowercase
+--exponentgrouping disabled
+--extensionacl on-extension
+--extensionlength 0
+--extensionmark "MARK: - %t + %c"
+--fractiongrouping disabled
+--fragment false
+--funcattributes preserve
+--groupedextension "MARK: %c"
+--guardelse auto
+--header ignore
+--hexgrouping 4,8
+--hexliteralcase uppercase
+--ifdef indent
+--importgrouping alphabetized
+--indent 4
+--indentcase false
+--lifecycle 
+--linebreaks lf
+--markextensions always
+--marktypes always
+--maxwidth none
+--modifierorder 
+--nevertrailing 
+--nospaceoperators ...,..<
+--nowrapoperators 
+--octalgrouping none
+--operatorfunc spaced
+--organizetypes class,enum,struct
+--patternlet hoist
+--ranges spaced
+--redundanttype inferred
+--self remove
+--selfrequired 
+--semicolons inline
+--shortoptionals always
+--smarttabs enabled
+--stripunusedargs closure-only
+--structthreshold 0
+--tabwidth unspecified
+--trailingclosures 
+--trimwhitespace always
+--typeattributes preserve
+--typemark "MARK: - %t"
+--varattributes preserve
+--voidtype void
+--wraparguments preserve
+--wrapcollections preserve
+--wrapconditions preserve
+--wrapparameters preserve
+--wrapreturntype preserve
+--xcodeindentation disabled
+--yodaswap always

+ 1 - 1
BFAnalyzeKit/Classes/BFBaseEventTrack.swift

@@ -189,7 +189,7 @@ public class BFBaseEventTrack: NSObject {
     //   - businessType: <#businessType description#>
     //   - businessType: <#businessType description#>
     //   - targetUid: <#targetUid description#>
     //   - targetUid: <#targetUid description#>
     //   - shareId: <#shareId description#>
     //   - shareId: <#shareId description#>
-    public class func bf_shareReportUpload(url: String, isShareVideo: Bool = true, screenType: Int = 1, videoId: String?, recommendId: String?, recommendLogVO: String?, flowPool: String?, abInfoData: String?, measureType: Int?, measureId: Int?, targetUid: Int?, shareId: String = "", playId: String?, wxOpenId: String?, businessType: String?, pageSource: String?, extParams: [String: Any]? = nil, commonParams: [String: Any]? = nil) {
+    public class func bf_shareReportUpload(url: String, isShareVideo: Bool = true, screenType _: Int = 1, videoId: String?, recommendId: String?, recommendLogVO: String?, flowPool: String?, abInfoData: String?, measureType: Int?, measureId: Int?, targetUid: Int?, shareId: String = "", playId: String?, wxOpenId: String?, businessType: String?, pageSource: String?, extParams: [String: Any]? = nil, commonParams: [String: Any]? = nil) {
         DispatchQueue.global().async {
         DispatchQueue.global().async {
             var params: [String: Any] = ["type": isShareVideo ? "1" : "2", "videoId": videoId ?? "", "pageSource": pageSource ?? "", "playId": playId ?? "", "targetUid": targetUid ?? 0, "shareDepth": "0"]
             var params: [String: Any] = ["type": isShareVideo ? "1" : "2", "videoId": videoId ?? "", "pageSource": pageSource ?? "", "playId": playId ?? "", "targetUid": targetUid ?? 0, "shareDepth": "0"]
             if extParams != nil {
             if extParams != nil {

+ 11 - 10
BFAnalyzeKit/Classes/PQVideoMakeEventTrackModel.swift

@@ -6,9 +6,9 @@
 //  Copyright © 2021 BytesFlow. All rights reserved.
 //  Copyright © 2021 BytesFlow. All rights reserved.
 //
 //
 
 
-import UIKit
 import BFCommonKit
 import BFCommonKit
 import BFNetRequestKit
 import BFNetRequestKit
+import UIKit
 
 
 public class PQVideoMakeEventTrackModel: NSObject {
 public class PQVideoMakeEventTrackModel: NSObject {
     // 进入创作工具的入口
     // 进入创作工具的入口
@@ -116,14 +116,15 @@ public class PQVideoMakeEventTrackModel: NSObject {
     public var syncedUpOriginalMaterialDuration: Float64 = 0
     public var syncedUpOriginalMaterialDuration: Float64 = 0
     // 卡点视频 视频选用节奏名称(快节奏 1、适中 2、慢节奏 3))
     // 卡点视频 视频选用节奏名称(快节奏 1、适中 2、慢节奏 3))
     public var syncedUpRhythmNumber: Int = 2
     public var syncedUpRhythmNumber: Int = 2
-    public var syncedUpVideoType:createStickersModel = .createStickersModelPoint
-    public var syncedUpVideoSpeedMax:Float = 0.0
-    public var syncedUpVideoSpeedMin:Float = 0.0
-    public var abInfoData:Dictionary<String,Any>?
-    
+    public var syncedUpVideoType: createStickersModel = .createStickersModelPoint
+    public var syncedUpVideoSpeedMax: Float = 0.0
+    public var syncedUpVideoSpeedMin: Float = 0.0
+    public var abInfoData: [String: Any]?
+
     override public init() {
     override public init() {
         super.init()
         super.init()
     }
     }
+
     /// 转换为字典
     /// 转换为字典
     /// - Returns: <#description#>
     /// - Returns: <#description#>
     public func toParams() -> [String: Any] {
     public func toParams() -> [String: Any] {
@@ -223,12 +224,12 @@ public class PQVideoMakeEventTrackModel: NSObject {
         // 卡点视频 视频选用节奏名称(快节奏 1、适中 2、慢节奏 3))
         // 卡点视频 视频选用节奏名称(快节奏 1、适中 2、慢节奏 3))
         eventTrackDic["syncedUpRhythmNumber"] = syncedUpRhythmNumber
         eventTrackDic["syncedUpRhythmNumber"] = syncedUpRhythmNumber
 
 
-        //-     1:跳跃卡点,2:快慢速,3:仅配乐
-        if(syncedUpVideoType == .createStickersModelOnlyMusic){
+        // -     1:跳跃卡点,2:快慢速,3:仅配乐
+        if syncedUpVideoType == .createStickersModelOnlyMusic {
             eventTrackDic["syncedUpVideoType"] = "3"
             eventTrackDic["syncedUpVideoType"] = "3"
-        }else if(syncedUpVideoType == .createStickersModelPoint){
+        } else if syncedUpVideoType == .createStickersModelPoint {
             eventTrackDic["syncedUpVideoType"] = "1"
             eventTrackDic["syncedUpVideoType"] = "1"
-        }else if(syncedUpVideoType == .createStickersModelSpeed){
+        } else if syncedUpVideoType == .createStickersModelSpeed {
             eventTrackDic["syncedUpVideoType"] = "2"
             eventTrackDic["syncedUpVideoType"] = "2"
             eventTrackDic["syncedUpVideoSpeed"] = "[\(syncedUpVideoSpeedMax),\(syncedUpVideoSpeedMin)]"
             eventTrackDic["syncedUpVideoSpeed"] = "[\(syncedUpVideoSpeedMax),\(syncedUpVideoSpeedMin)]"
         }
         }

+ 6 - 11
Example/BFAnalyzeKit/AppDelegate.swift

@@ -10,37 +10,32 @@ import UIKit
 
 
 @UIApplicationMain
 @UIApplicationMain
 class AppDelegate: UIResponder, UIApplicationDelegate {
 class AppDelegate: UIResponder, UIApplicationDelegate {
-
     var window: UIWindow?
     var window: UIWindow?
 
 
-
-    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
+    func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
         // Override point for customization after application launch.
         // Override point for customization after application launch.
         return true
         return true
     }
     }
 
 
-    func applicationWillResignActive(_ application: UIApplication) {
+    func applicationWillResignActive(_: UIApplication) {
         // 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 or SMS message) or when the user quits the application and it begins the transition to the background state.
         // 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 or SMS message) or when the user quits the application and it begins the transition to the background state.
         // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
         // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
     }
     }
 
 
-    func applicationDidEnterBackground(_ application: UIApplication) {
+    func applicationDidEnterBackground(_: UIApplication) {
         // 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.
         // 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.
         // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
         // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
     }
     }
 
 
-    func applicationWillEnterForeground(_ application: UIApplication) {
+    func applicationWillEnterForeground(_: UIApplication) {
         // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
         // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
     }
     }
 
 
-    func applicationDidBecomeActive(_ application: UIApplication) {
+    func applicationDidBecomeActive(_: UIApplication) {
         // 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.
         // 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.
     }
     }
 
 
-    func applicationWillTerminate(_ application: UIApplication) {
+    func applicationWillTerminate(_: UIApplication) {
         // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
         // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
     }
     }
-
-
 }
 }
-

+ 0 - 3
Example/BFAnalyzeKit/ViewController.swift

@@ -9,7 +9,6 @@
 import UIKit
 import UIKit
 
 
 class ViewController: UIViewController {
 class ViewController: UIViewController {
-
     override func viewDidLoad() {
     override func viewDidLoad() {
         super.viewDidLoad()
         super.viewDidLoad()
         // Do any additional setup after loading the view, typically from a nib.
         // Do any additional setup after loading the view, typically from a nib.
@@ -19,6 +18,4 @@ class ViewController: UIViewController {
         super.didReceiveMemoryWarning()
         super.didReceiveMemoryWarning()
         // Dispose of any resources that can be recreated.
         // Dispose of any resources that can be recreated.
     }
     }
-
 }
 }
-

+ 5 - 7
Example/Tests/Tests.swift

@@ -1,28 +1,26 @@
-import XCTest
 import BFAnalyzeKit
 import BFAnalyzeKit
+import XCTest
 
 
 class Tests: XCTestCase {
 class Tests: XCTestCase {
-    
     override func setUp() {
     override func setUp() {
         super.setUp()
         super.setUp()
         // Put setup code here. This method is called before the invocation of each test method in the class.
         // Put setup code here. This method is called before the invocation of each test method in the class.
     }
     }
-    
+
     override func tearDown() {
     override func tearDown() {
         // Put teardown code here. This method is called after the invocation of each test method in the class.
         // Put teardown code here. This method is called after the invocation of each test method in the class.
         super.tearDown()
         super.tearDown()
     }
     }
-    
+
     func testExample() {
     func testExample() {
         // This is an example of a functional test case.
         // This is an example of a functional test case.
         XCTAssert(true, "Pass")
         XCTAssert(true, "Pass")
     }
     }
-    
+
     func testPerformanceExample() {
     func testPerformanceExample() {
         // This is an example of a performance test case.
         // This is an example of a performance test case.
-        self.measure() {
+        measure {
             // Put the code you want to measure the time of here.
             // Put the code you want to measure the time of here.
         }
         }
     }
     }
-    
 }
 }

+ 67 - 0
rules.swiftformat

@@ -0,0 +1,67 @@
+--allman false
+--assetliterals visual-width
+--beforemarks 
+--binarygrouping 4,8
+--categorymark "MARK: %c"
+--classthreshold 0
+--closingparen balanced
+--commas always
+--conflictmarkers reject
+--decimalgrouping 3,6
+--elseposition same-line
+--enumthreshold 0
+--exponentcase lowercase
+--exponentgrouping disabled
+--extensionacl on-extension
+--extensionlength 0
+--extensionmark "MARK: - %t + %c"
+--fractiongrouping disabled
+--fragment false
+--funcattributes preserve
+--groupedextension "MARK: %c"
+--guardelse auto
+--header ignore
+--hexgrouping 4,8
+--hexliteralcase uppercase
+--ifdef indent
+--importgrouping alphabetized
+--indent 4
+--indentcase false
+--lifecycle 
+--linebreaks lf
+--markextensions always
+--marktypes always
+--maxwidth none
+--modifierorder 
+--nevertrailing 
+--nospaceoperators 
+--nowrapoperators 
+--octalgrouping 4,8
+--operatorfunc spaced
+--organizetypes class,enum,struct
+--patternlet hoist
+--ranges spaced
+--redundanttype inferred
+--self remove
+--selfrequired 
+--semicolons inline
+--shortoptionals always
+--smarttabs enabled
+--stripunusedargs always
+--structthreshold 0
+--swiftversion 4.0
+--tabwidth unspecified
+--trailingclosures 
+--trimwhitespace always
+--typeattributes preserve
+--typemark "MARK: - %t"
+--varattributes preserve
+--voidtype void
+--wraparguments preserve
+--wrapcollections preserve
+--wrapconditions preserve
+--wrapparameters preserve
+--wrapreturntype preserve
+--xcodeindentation disabled
+--yodaswap always
+--disable initCoderUnavailable,redundantType