Skip to content

Commit

Permalink
Merge pull request #100 from adessoTurkey/feature/SASU-0077
Browse files Browse the repository at this point in the history
[SASU-0077] - Xcode 15 Overhaul
  • Loading branch information
egesucu authored Oct 25, 2023
2 parents 38df3a1 + 76752c3 commit edf4db9
Show file tree
Hide file tree
Showing 48 changed files with 847 additions and 676 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/ios-build-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ env:
jobs:
build:
name: Build scheme
runs-on: macos-latest

runs-on: macos-13
steps:
- name: Select Latest Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Checkout
uses: actions/checkout@v3
- name: Xcodegen
Expand All @@ -30,8 +33,8 @@ jobs:
run: |
xcodebuild -scheme SampleAppSwiftUI clean build -sdk iphoneos -configuration Development CODE_SIGNING_ALLOWED=No -destination 'generic/platform=iOS Simulator' CONFIGURATION_BUILD_DIR=$PWD/build
- name: UI Test
uses: mobile-dev-inc/action-maestro-cloud@v1
uses: mobile-dev-inc/action-maestro-cloud@v1.6.0
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: build/SampleAppSwiftUI.app
ios-version: 16
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: build/SampleAppSwiftUI.app
ios-version: 16
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![swift-version](https://img.shields.io/badge/swift-5.8-brightgreen.svg)](https://github.com/apple/swift)
[![swift-version](https://img.shields.io/badge/swift-5.9-brightgreen.svg)](https://github.com/apple/swift)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/adessoTurkey/boilerplate-ios-swiftui/iOS%20Build%20Check%20Workflow/develop)

Expand All @@ -12,6 +12,7 @@ This is the iOS SwiftUI Sample App created by adesso Turkey. The project serves
- Usage of Swift concurrency (async/await)
- WebSocket implementation for real-time price change.
- Up-to-date SWiftUI features (Navigation stack etc.)
- Using the new String Catalog
- Using only [SPM](https://www.swift.org/package-manager/) for package dependencies.
- Able to favorite and save the coins using [AppStorage](https://developer.apple.com/documentation/swiftui/appstorage).

Expand All @@ -27,26 +28,24 @@ This is the iOS SwiftUI Sample App created by adesso Turkey. The project serves

## Prerequisites

- [Swift 5.8](https://developer.apple.com/support/xcode/)
- [MacOS Monterey (12.5 or higher)](https://www.apple.com/by/macos/monterey/features/)
- [Xcode 14 or higher](https://developer.apple.com/documentation/xcode-release-notes/xcode-14-release-notes)
- [Swift 5.9](https://developer.apple.com/support/xcode/)
- [MacOS Ventura (13.4 or higher)](https://www.apple.com/macos/ventura/features/)
- [Xcode 15 or higher](https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes)
- [Swiftlint][github/swiftlint]
- [SwiftGen](https://github.com/SwiftGen/SwiftGen)
- [XcodeGen](https://github.com/yonaskolb/XcodeGen)

## Installation

Because XcodeGen is used in this project, there will be no `.xcodeproj` or `.xcworkspace` files when it first cloned. To generate them using the `project.yml` file, run

```sh
xcodegen generate
xcodegen
```

Swiftlint and SwiftGen can also be installed via included scripts in the repository. Under the `{project_root}/scripts/installation` directory, simply run either or both of:
Swiftlint can also be installed via included scripts in the repository. Under the `{project_root}/scripts/installation` directory, simply run:

```
sh swiftlint.sh
sh swiftgen.sh
```

## Branching Strategy
Expand Down Expand Up @@ -103,7 +102,6 @@ Gitflow is a legacy Git workflow that was originally a disruptive and novel stra

## Useful Tools and Resources

- [SwiftGen](https://github.com/SwiftGen/SwiftGen) - SwiftGen is a tool to automatically generate Swift code for resources of your projects (like images, localised strings, etc), to make them type-safe to use.
- [XcodeGen](https://github.com/yonaskolb/XcodeGen) - XcodeGen is a command line tool written in Swift that generates your Xcode project using your folder structure and a project spec.
- [SwiftLint][github/swiftlint] - A tool to enforce Swift style and conventions.
- [TestFlight](https://help.apple.com/itunes-connect/developer/#/devdc42b26b8) - TestFlight beta testing lets you distribute beta builds of your app to testers and collect feedback.
Expand Down
2 changes: 1 addition & 1 deletion SampleAppSwiftUI/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ class AppDelegate: NSObject, UIApplicationDelegate {

func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
// Handle remote notification failures here
print(error.localizedDescription)
LoggerManager().setError(errorMessage: error.localizedDescription)
}
}
6 changes: 4 additions & 2 deletions SampleAppSwiftUI/Application/SampleAppSwiftUIApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct SampleAppSwiftUIApp: App {
// Check out https://developer.apple.com/documentation/swiftui/scenephase for more information
@UIApplicationDelegateAdaptor private var appDelegate: AppDelegate
private var loggingService: LoggingService
@StateObject private var router: Router = Router()
@StateObject private var router = Router()

init() {
UITabBar.appearance().scrollEdgeAppearance = UITabBarAppearance.init(idiom: .unspecified)
Expand All @@ -25,7 +25,9 @@ struct SampleAppSwiftUIApp: App {
WindowGroup {
MainView()
.environmentObject(router)
.onChange(of: phase, perform: manageChanges(for:))
.onChange(of: phase, perform: { newValue in
manageChanges(for: newValue)
})
.onOpenURL(perform: onOpenURL(_:))
}
}
Expand Down
3 changes: 3 additions & 0 deletions SampleAppSwiftUI/Managers/LoggerManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
//

import CocoaLumberjack
import CocoaLumberjackSwiftLogBackend
import Logging

class LoggerManager {

Expand All @@ -32,6 +34,7 @@ class LoggerManager {

logger.setLogLevel(level)
DDLog.add(ddosLogger)
LoggingSystem.bootstrapWithCocoaLumberjack()

let fileManager = DDLogFileManagerDefault(logsDirectory: documentsDirectory)
fileLogger = DDFileLogger(logFileManager: fileManager)
Expand Down
2 changes: 1 addition & 1 deletion SampleAppSwiftUI/Managers/SwifterManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class SwifterManager {
do {
try swifterServer.start(Constants.port)
} catch let error {
print(error)
LoggerManager().setError(errorMessage: error.localizedDescription)
}
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion SampleAppSwiftUI/Network/Base/BaseServiceProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ extension BaseServiceProtocol {
private func prepareAuthenticatedRequest(with requestObject: inout RequestObject) -> RequestObject {
// TODO: - handle authenticatedRequest with urlSession

return requestObject
requestObject
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ enum CoinNewsServiceEndpoint: TargetEndpointProtocol {
switch self {
case .coinNews(coinCode: let coinCode):
return BaseEndpoint.base.path + String(format: Constants.coinNewsEndpoint, coinCode, Configuration.coinApiKey)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ enum ExampleServiceEndpoint: TargetEndpointProtocol {
switch self {
case .example(let firstParameter, let secondParameter):
return BaseEndpoint.base.path + String(format: Constants.exampleEndpoint, firstParameter, secondParameter)
}
}
}
}
4 changes: 2 additions & 2 deletions SampleAppSwiftUI/Network/WebSocket/Base/WebSocketStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ class WebSocketStream: NSObject, AsyncSequence {
guard let self else { return }
self.task.sendPing { error in
if let error {
debugPrint("Pong Error: ", error)
LoggerManager().setError(errorMessage: "Pong Error: \(error.localizedDescription)")
timer.invalidate()
} else {
debugPrint("Connection is alive")
Logger().log(level: .info, message: "Connection is alive")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ extension FavoritesCoinRequest {
init(action: SubscriptionRequestAction, codeList: [CoinCode], toChange: String = "USD") {
self.action = action.rawValue
self.subs = []
codeList.forEach({ self.subs.append(Strings.coinPreRequest($0, toChange)) })
codeList.forEach({ self.subs.append(String(format: String(localized: "CoinPreRequest"), $0, toChange)) })
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ class WebSocketSubscription<S: Subscriber>: Subscription where S.Input == URLSes

private func listenSocket() async {
guard let subscriber = subscriber else {
debugPrint("no subscriber")
return }
LoggerManager().setError(errorMessage: "no subscriber")
return
}
do {
for try await message in socket {
_ = subscriber.receive(message)
}
} catch {
debugPrint("Something went wrong")
} catch let error {
LoggerManager().setError(errorMessage: "Something went wrong \(error.localizedDescription)")
}
}
}
Loading

0 comments on commit edf4db9

Please sign in to comment.