diff --git a/iOS/MaybeGamsung/.swift-version b/iOS/MaybeGamsung/.swift-version new file mode 100644 index 0000000..95ee81a --- /dev/null +++ b/iOS/MaybeGamsung/.swift-version @@ -0,0 +1 @@ +5.9 diff --git a/iOS/MaybeGamsung/.swiftformat b/iOS/MaybeGamsung/.swiftformat new file mode 100644 index 0000000..d92e7aa --- /dev/null +++ b/iOS/MaybeGamsung/.swiftformat @@ -0,0 +1,11 @@ +# 코드 들여쓰기 +--indent 4 + +# 공백 문자 삭제 +--trimwhitespace always + +# 줄 바꿈 문자 관리 +--linebreaks lf #cr, lf, crlf + +# wrapMultilineStatementBraces 비활성화 +--disable wrapMultilineStatementBraces diff --git a/iOS/MaybeGamsung/.swiftlint.yml b/iOS/MaybeGamsung/.swiftlint.yml new file mode 100644 index 0000000..4ec0578 --- /dev/null +++ b/iOS/MaybeGamsung/.swiftlint.yml @@ -0,0 +1,27 @@ +# 한 라인 길이 제한 +line_length: + warning: 120 #default: 120 + error: 200 + +# 강제 형변환 +force_cast: error +force_try: error + +# 의미없는 공백/줄 바꿈 +trailing_newline: warning +trailing_whitespace: + severity: warning + +# 함수 길이 제한 +function_body_length: + warning: 50 + error: 100 + +# 타입 지정 시, 이름 조건 +type_name: + min_length: + warning: 3 + error: 0 + max_length: + warning: 40 + error: 1000 diff --git a/iOS/MaybeGamsung/MaybeGamsung.xcodeproj/project.pbxproj b/iOS/MaybeGamsung/MaybeGamsung.xcodeproj/project.pbxproj index f584bb2..a96a19c 100644 --- a/iOS/MaybeGamsung/MaybeGamsung.xcodeproj/project.pbxproj +++ b/iOS/MaybeGamsung/MaybeGamsung.xcodeproj/project.pbxproj @@ -7,6 +7,9 @@ objects = { /* Begin PBXBuildFile section */ + 2179E5EE2AFB94D500746FD8 /* .swiftlint.yml in Resources */ = {isa = PBXBuildFile; fileRef = 2179E5ED2AFB94D500746FD8 /* .swiftlint.yml */; }; + 2179E5F22AFBA08800746FD8 /* .swiftformat in Resources */ = {isa = PBXBuildFile; fileRef = 2179E5F12AFBA08700746FD8 /* .swiftformat */; }; + 2179E5F42AFBA46300746FD8 /* .swift-version in Resources */ = {isa = PBXBuildFile; fileRef = 2179E5F32AFBA46300746FD8 /* .swift-version */; }; DD10AA2B2AFB874C00F5828A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD10AA2A2AFB874C00F5828A /* AppDelegate.swift */; }; DD10AA2D2AFB874C00F5828A /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD10AA2C2AFB874C00F5828A /* SceneDelegate.swift */; }; DD10AA2F2AFB874C00F5828A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD10AA2E2AFB874C00F5828A /* ViewController.swift */; }; @@ -16,6 +19,9 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 2179E5ED2AFB94D500746FD8 /* .swiftlint.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = .swiftlint.yml; sourceTree = ""; }; + 2179E5F12AFBA08700746FD8 /* .swiftformat */ = {isa = PBXFileReference; explicitFileType = text.yaml; path = .swiftformat; sourceTree = ""; }; + 2179E5F32AFBA46300746FD8 /* .swift-version */ = {isa = PBXFileReference; lastKnownFileType = text; path = ".swift-version"; sourceTree = ""; }; DD10AA272AFB874C00F5828A /* MaybeGamsung.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MaybeGamsung.app; sourceTree = BUILT_PRODUCTS_DIR; }; DD10AA2A2AFB874C00F5828A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; DD10AA2C2AFB874C00F5828A /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; @@ -40,6 +46,9 @@ DD10AA1E2AFB874C00F5828A = { isa = PBXGroup; children = ( + 2179E5F32AFBA46300746FD8 /* .swift-version */, + 2179E5F12AFBA08700746FD8 /* .swiftformat */, + 2179E5ED2AFB94D500746FD8 /* .swiftlint.yml */, DD10AA292AFB874C00F5828A /* MaybeGamsung */, DD10AA282AFB874C00F5828A /* Products */, ); @@ -77,6 +86,8 @@ DD10AA232AFB874C00F5828A /* Sources */, DD10AA242AFB874C00F5828A /* Frameworks */, DD10AA252AFB874C00F5828A /* Resources */, + 2179E5EF2AFB94ED00746FD8 /* Swift Lint */, + 2179E5F02AFBA02700746FD8 /* Swift Format */, ); buildRules = ( ); @@ -125,14 +136,58 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 2179E5F22AFBA08800746FD8 /* .swiftformat in Resources */, + 2179E5EE2AFB94D500746FD8 /* .swiftlint.yml in Resources */, DD10AA372AFB874D00F5828A /* LaunchScreen.storyboard in Resources */, DD10AA342AFB874D00F5828A /* Assets.xcassets in Resources */, + 2179E5F42AFBA46300746FD8 /* .swift-version in Resources */, DD10AA322AFB874C00F5828A /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 2179E5EF2AFB94ED00746FD8 /* Swift Lint */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Swift Lint"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "export PATH=\"$PATH:/opt/homebrew/bin\"\nif which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; + }; + 2179E5F02AFBA02700746FD8 /* Swift Format */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Swift Format"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "export PATH=\"$PATH:/opt/homebrew/bin\"\nif which swiftformat > /dev/null; then\n swiftformat .\nelse\n echo \"warning: SwiftFormat not installed, download from https://github.com/nicklockwood/SwiftFormat\"\nfi\n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ DD10AA232AFB874C00F5828A /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -293,6 +348,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = B3PWYBKFUK; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = MaybeGamsung/Info.plist; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; @@ -325,6 +381,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = B3PWYBKFUK; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = MaybeGamsung/Info.plist; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; diff --git a/iOS/MaybeGamsung/MaybeGamsung/AppDelegate.swift b/iOS/MaybeGamsung/MaybeGamsung/AppDelegate.swift index 9e3400a..cae44a1 100644 --- a/iOS/MaybeGamsung/MaybeGamsung/AppDelegate.swift +++ b/iOS/MaybeGamsung/MaybeGamsung/AppDelegate.swift @@ -9,28 +9,18 @@ import UIKit @main class AppDelegate: UIResponder, UIApplicationDelegate { - - - - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - // Override point for customization after application launch. - return true + func application(_: UIApplication, + didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + true } // MARK: UISceneSession Lifecycle - func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { - // Called when a new scene session is being created. - // Use this method to select a configuration to create the new scene with. - return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) + func application(_: UIApplication, + configurationForConnecting connectingSceneSession: UISceneSession, + options _: UIScene.ConnectionOptions) -> UISceneConfiguration { + UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) } - func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { - // Called when the user discards a scene session. - // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. - // Use this method to release any resources that were specific to the discarded scenes, as they will not return. - } - - + func application(_: UIApplication, didDiscardSceneSessions _: Set) {} } - diff --git a/iOS/MaybeGamsung/MaybeGamsung/SceneDelegate.swift b/iOS/MaybeGamsung/MaybeGamsung/SceneDelegate.swift index 0003219..103ff47 100644 --- a/iOS/MaybeGamsung/MaybeGamsung/SceneDelegate.swift +++ b/iOS/MaybeGamsung/MaybeGamsung/SceneDelegate.swift @@ -8,45 +8,11 @@ import UIKit class SceneDelegate: UIResponder, UIWindowSceneDelegate { - var window: UIWindow? - - func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { - // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. - // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. - // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). - guard let _ = (scene as? UIWindowScene) else { return } - } - - func sceneDidDisconnect(_ scene: UIScene) { - // Called as the scene is being released by the system. - // This occurs shortly after the scene enters the background, or when its session is discarded. - // Release any resources associated with this scene that can be re-created the next time the scene connects. - // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). - } - - func sceneDidBecomeActive(_ scene: UIScene) { - // Called when the scene has moved from an inactive state to an active state. - // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. - } - - func sceneWillResignActive(_ scene: UIScene) { - // Called when the scene will move from an active state to an inactive state. - // This may occur due to temporary interruptions (ex. an incoming phone call). + func scene(_ scene: UIScene, + willConnectTo _: UISceneSession, + options _: UIScene.ConnectionOptions) { + guard (scene as? UIWindowScene) != nil else { return } } - - func sceneWillEnterForeground(_ scene: UIScene) { - // Called as the scene transitions from the background to the foreground. - // Use this method to undo the changes made on entering the background. - } - - func sceneDidEnterBackground(_ scene: UIScene) { - // Called as the scene transitions from the foreground to the background. - // Use this method to save data, release shared resources, and store enough scene-specific state information - // to restore the scene back to its current state. - } - - } - diff --git a/iOS/MaybeGamsung/MaybeGamsung/ViewController.swift b/iOS/MaybeGamsung/MaybeGamsung/ViewController.swift index 8fc5dae..599007a 100644 --- a/iOS/MaybeGamsung/MaybeGamsung/ViewController.swift +++ b/iOS/MaybeGamsung/MaybeGamsung/ViewController.swift @@ -8,12 +8,8 @@ import UIKit class ViewController: UIViewController { - - override func viewDidLoad() { - super.viewDidLoad() - // Do any additional setup after loading the view. - } - - +// override func viewDidLoad() { +// super.viewDidLoad() +// // Do any additional setup after loading the view. +// } } -