Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release - 4.9.0 #535

Merged
merged 27 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4cf4cbb
[#495] Add Swift package for Make
blyscuit Aug 22, 2023
0c2d1d4
[#495] Modify readme for Swift command
blyscuit Aug 30, 2023
0e72643
[#495] Add helper for Env
blyscuit Aug 30, 2023
3fcb789
[#495] Remove template workflows when using template
blyscuit Aug 30, 2023
a5dd60b
[#495] Fix uikit script
blyscuit Sep 28, 2023
87b99d8
[#495] Fix interface script
blyscuit Oct 4, 2023
a7b948a
[#495] Fix removal script
blyscuit Oct 4, 2023
6a8546d
[#495] Skip Rename swift build
blyscuit Oct 4, 2023
e3fb966
[#495] Skip Rename png
blyscuit Oct 4, 2023
afedd78
Merge pull request #514 from nimblehq/feature/#495-package-setup-swif…
blyscuit Oct 4, 2023
07ea0ff
[#515] Remove all Rx things
nkhanh44 Sep 28, 2023
78dafeb
[#515] Add asyn await to network layer
nkhanh44 Oct 2, 2023
1f226eb
[#515] Refactor NetworkAPIProtocol
nkhanh44 Oct 4, 2023
034edae
[#515] Refactor NetworkAPIProtocol and move them to shared folder
nkhanh44 Oct 4, 2023
94b3a23
Merge pull request #525 from nimblehq/chore/#515-remove-rxswift-and-i…
blyscuit Oct 5, 2023
6658c62
[#508] Add network test
blyscuit Oct 4, 2023
d917c57
[#508] Update Quick and Nimble to support Async
blyscuit Oct 5, 2023
7151ff8
[#508] Add folder for Data layer Dummy
blyscuit Oct 6, 2023
be01e39
[#508] Fix build Rx
blyscuit Oct 6, 2023
fa5826a
[#530] Fix build
blyscuit Oct 6, 2023
d10fa8b
Merge pull request #526 from nimblehq/feature/#508-swiftui-network-un…
blyscuit Oct 9, 2023
ed8c984
[#482] Update Quick and Nimble with better support for async
blyscuit Oct 5, 2023
d2905e6
[#482] Update KIF
blyscuit Oct 5, 2023
3b6e33a
[#482] Update Async spec
blyscuit Oct 5, 2023
325657d
Merge pull request #527 from nimblehq/feature/#482-upgrade-quick-nimble
blyscuit Oct 17, 2023
6f4e939
[487] Update swiftlint implicit_return rule
ducbm051291 Oct 26, 2023
5f80dc3
Merge pull request #537 from nimblehq/feature/478-add-swift-lint-rule…
blyscuit Oct 31, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/project_workflows/publish_docs_to_wiki.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Publish docs to Wiki

on:
push:
paths:
- .github/wiki/**
branches:
- main
- master

jobs:
publish_docs_to_wiki:
name: Publish Wiki
uses: nimblehq/github-actions-workflows/.github/workflows/[email protected]
with:
USER_NAME: team-nimblehq
USER_EMAIL: [email protected]
secrets:
USER_TOKEN: ${{ secrets.NIMBLE_DEV_TOKEN }}
2 changes: 1 addition & 1 deletion .github/wiki/Deliverable-Configurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The file [DeliverableConstants.rb](https://github.com/nimblehq/ios-templates/blo

## Use the template

1. Running the `make.sh` script will ask if the developer wants to configure the `DeliverableConstants` file.
1. Running the `iOSTemplateMaker` script will ask if the developer wants to configure the `DeliverableConstants` file.
2. When confirming with the prompt, the template will launch Xcode to modify the `DeliverableConstants` file.

## Configure later
Expand Down
18 changes: 17 additions & 1 deletion .github/wiki/Getting-Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,21 @@
2. Clone your repository
3. Setup the project by running the following command in your terminal:
```bash
sh make.sh --bundle-id [BUNDLE_ID_PRODUCTION] --bundle-id-staging [BUNDLE_ID_STAGING] --project-name [PROJECT_NAME]
swift run --package-path Scripts/Swift/iOSTemplateMaker iOSTemplateMaker make
```

## Options

Options are optional and will be prompted if not provided. Example is provided in (brackets).

- `--bundle-id-production`: The application's bundle id for production variant. (co.nimblehq.project)
- `--bundle-id-staging`: The application's bundle id for staging variant. (co.nimblehq.project.staging)
- `--project-name`: The name of the project. (Project)
- `--minimum-version`: The minimum version of the iOS application. (14.0)
- `--interface`: The user interface. (UIKit or SwiftUI)

### Example

```
swift run --package-path Scripts/Swift/iOSTemplateMaker iOSTemplateMaker make --bundle-id-production co.nimblehq.ios.templates --bundle-id-staging co.nimblehq.ios.templates.staging --project-name TemplateApp --interface SwiftUI
```
2 changes: 1 addition & 1 deletion .github/wiki/Selecting-User-Interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ Current the template supports setup with two user interfaces:
To select a user interface when creating a project pass the argument `--interface [SwiftUI or UIKit]` with the `make` script.

```bash
sh make.sh --bundle-id [BUNDLE_ID_PRODUCTION] --bundle-id-staging [BUNDLE_ID_STAGING] --project-name [PROJECT_NAME] --interface SwiftUI
swift run --package-path Scripts/Swift/iOSTemplateMaker iOSTemplateMaker make --interface SwiftUI
```
2 changes: 1 addition & 1 deletion .github/workflows/test_swiftui_install_script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
run: bundle install

- name: Start Install Script for SwiftUI Template App
run: sh make.sh --bundle-id co.nimblehq.template --bundle-id-staging co.nimblehq.template.staging --project-name TemplateApp --interface SwiftUI
run: swift run --package-path Scripts/Swift/iOSTemplateMaker iOSTemplateMaker make --bundle-id-production co.nimblehq.ios.templates --bundle-id-staging co.nimblehq.ios.templates.staging --project-name TemplateApp --interface SwiftUI

- name: Build and Test
run: bundle exec fastlane buildAndTest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_uikit_install_script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
run: bundle install

- name: Start Install Script for UIKit Template App
run: sh make.sh --bundle-id co.nimblehq.template --bundle-id-staging co.nimblehq.template.staging --project-name TemplateApp --interface UIKit
run: swift run --package-path Scripts/Swift/iOSTemplateMaker iOSTemplateMaker make --bundle-id-production co.nimblehq.ios.templates --bundle-id-staging co.nimblehq.ios.templates.staging --project-name TemplateApp --interface UIKit

- name: Build and Test
run: bundle exec fastlane buildAndTest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_upload_build_to_firebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ jobs:
${{ runner.os }}-pods-

- name: Start Install Script for Template App
run: sh make.sh --bundle-id co.nimblehq.ios.templates --bundle-id-staging co.nimblehq.ios.templates.staging --project-name TemplateApp --interface UIKit
run: swift run --package-path Scripts/Swift/iOSTemplateMaker iOSTemplateMaker make --bundle-id-production co.nimblehq.ios.templates --bundle-id-staging co.nimblehq.ios.templates.staging --project-name TemplateApp --interface UIKit

- name: Start Setup Script for Template App Firebase Upload
run: cat Scripts/Swift/SetUpTestFirebase.swift Scripts/Swift/Extensions/FileManager+Utils.swift | swift -
run: swift run --package-path Scripts/Swift/iOSTemplateMaker iOSTemplateMaker make-test-firebase
env:
MATCH_REPO: ${{ secrets.MATCH_REPO }}
STAGING_FIREBASE_APP_ID: ${{ secrets.STAGING_FIREBASE_APP_ID }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_upload_build_to_test_flight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ jobs:
${{ runner.os }}-pods-

- name: Start Install Script for Template App
run: sh make.sh --bundle-id co.nimblehq.ios.templates --bundle-id-staging co.nimblehq.ios.templates.staging --project-name TemplateApp --interface UIKit
run: swift run --package-path Scripts/Swift/iOSTemplateMaker iOSTemplateMaker make --bundle-id-production co.nimblehq.ios.templates --bundle-id-staging co.nimblehq.ios.templates.staging --project-name TemplateApp --interface UIKit

- name: Start Setup Script for Template App TestFlight Upload
run: cat Scripts/Swift/SetUpTestTestFlight.swift Scripts/Swift/Extensions/FileManager+Utils.swift | swift -
run: swift run --package-path Scripts/Swift/iOSTemplateMaker iOSTemplateMaker make-test-test-flight
env:
MATCH_REPO: ${{ secrets.MATCH_REPO }}
API_KEY_ID: ${{ secrets.API_KEY_ID }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,4 @@ dependencies/

# Environment
.env
Scripts/Swift/iOSTemplateMaker/.*
1 change: 1 addition & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ implicit_return:
included:
- closure
- getter
- function

custom_rules:
multiline_collection_one_per_line:
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ gem "danger-swiftlint"
gem "danger-xcode_summary"
gem 'danger-swiftformat'
gem 'danger-xcov'
# Fix issue with Cocoapods 13.0 when activesupport is 7.1.0
gem 'activesupport', '~> 7.0.0', '>= 7.0.8'

plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Our optimized iOS template used in our projects using Xcode Templates
2. Clone your repository
3. Setup the project by running the following command in your terminal:
```bash
sh make.sh --bundle-id [BUNDLE_ID_PRODUCTION] --bundle-id-staging [BUNDLE_ID_STAGING] --project-name [PROJECT_NAME]
swift run --package-path Scripts/Swift/iOSTemplateMaker iOSTemplateMaker make
```

## Full Documentation
Expand All @@ -53,4 +53,4 @@ We love open source and do our part in sharing our work with the community!
See [our other projects][community] or [hire our team][hire] to help build your product.

[community]: https://github.com/nimblehq
[hire]: https://nimblehq.co/
[hire]: https://nimblehq.co/
16 changes: 0 additions & 16 deletions Scripts/Swift/SetUpTestFirebase.swift

This file was deleted.

16 changes: 0 additions & 16 deletions Scripts/Swift/SetUpTestTestFlight.swift

This file was deleted.

14 changes: 14 additions & 0 deletions Scripts/Swift/iOSTemplateMaker/Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"pins" : [
{
"identity" : "swift-argument-parser",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser.git",
"state" : {
"revision" : "8f4d2753f0e4778c76d5f05ad16c74f707390531",
"version" : "1.2.3"
}
}
],
"version" : 2
}
28 changes: 28 additions & 0 deletions Scripts/Swift/iOSTemplateMaker/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// swift-tools-version: 5.7.1
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "iOSTemplateMaker",
products: [
.executable(
name: "iOSTemplateMaker",
targets: ["iOSTemplateMaker"]
),
],
dependencies: [
.package(
url: "https://github.com/apple/swift-argument-parser.git",
from: "1.0.0"
),
],
targets: [
.executableTarget(
name: "iOSTemplateMaker",
dependencies: [
.product(name: "ArgumentParser", package: "swift-argument-parser")
]
),
]
)
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,18 @@ extension FileManager {
}
}

func createFile(name: String, at directory: String) {
func createDirectory(path: String) {
let currentDirectory = currentDirectoryPath
do {
try createDirectory(atPath: "\(currentDirectory)/\(directory)", withIntermediateDirectories: true, attributes: nil)
try createDirectory(atPath: "\(currentDirectory)/\(path)", withIntermediateDirectories: true, attributes: nil)
} catch {
print("Error \(error)")
}
}

func createFile(name: String, at directory: String) {
let currentDirectory = currentDirectoryPath
createDirectory(path: directory)
createFile(atPath: "\(currentDirectory)\(directory)\(name)", contents: nil)
}

Expand All @@ -66,7 +71,9 @@ extension FileManager {
}

func replaceAllOccurrences(of original: String, to replacing: String) {
let files = try? allFiles(in: currentDirectoryPath)
let swiftScriptBuildDirectory = "Scripts/Swift/iOSTemplateMaker/.build".lowercased()
let pngImage = ".png"
let files = try? allFiles(in: currentDirectoryPath, skips: [swiftScriptBuildDirectory, pngImage])
guard let files else { return print("Cannot find any files in current directory") }
for file in files {
do {
Expand All @@ -79,7 +86,7 @@ extension FileManager {
}
}

private func allFiles(in directory: String) throws -> [URL] {
private func allFiles(in directory: String, skips: [String] = []) throws -> [URL] {
let url = URL(fileURLWithPath: directory)
var files = [URL]()
if let enumerator = enumerator(
Expand All @@ -90,6 +97,7 @@ extension FileManager {
let hiddenFolderRegex = "\(directory.replacingOccurrences(of: "/", with: "\\/"))\\/\\..*\\/"
for case let fileURL as URL in enumerator {
guard !(fileURL.relativePath ~= hiddenFolderRegex) else { continue }
guard !(skips.contains(where: { fileURL.relativePath.lowercased().contains($0) })) else { continue }
let fileAttributes = try? fileURL.resourceValues(forKeys:[.isRegularFileKey])
guard fileAttributes?.isRegularFile ?? false else { continue }
files.append(fileURL)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Foundation

extension Optional {

func unwrappedOr(_ defaultValue: Wrapped) -> Wrapped {
switch self {
case .none:
return defaultValue
case let .some(value):
return value
}
}
}

extension Optional where Wrapped == String {

var string: String { unwrappedOr("") }
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import Foundation

extension String {

/// Match string with regex expression
static func ~= (lhs: String, rhs: String) -> Bool {
guard let regex = try? NSRegularExpression(pattern: rhs) else { return false }
let range = NSRange(location: 0, length: lhs.utf16.count)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// EnvironmentValue.swift
//
//
// Created by Bliss on 30/8/23.
//

import Foundation

enum EnvironmentValue {

static func value(for key: String) -> String? {
ProcessInfo.processInfo.environment[key]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// EnvironmentKey.swift
//
//
// Created by Bliss on 30/8/23.
//

enum EnvironmentKey: String {

case matchRepo = "MATCH_REPO"
case stagingFirebaseAppId = "STAGING_FIREBASE_APP_ID"
case teamId = "TEAM_ID"
case apiKey = "API_KEY_ID"
case issuerId = "ISSUER_ID"
case isCI = "CI"
}

extension EnvironmentValue {

static func value(for key: EnvironmentKey) -> String? {
Self.value(for: key.rawValue)
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Foundation

struct SetUpCICDService {

enum CICDService {
Expand Down Expand Up @@ -26,14 +28,18 @@ struct SetUpCICDService {
var service: CICDService? = nil
while service == nil {
print("Which CI/CD service do you use (Can be edited later) [(g)ithub/(b)itrise/(c)odemagic/(l)ater]: ")
service = CICDService(readLine() ?? "")
service = CICDService(readLine().string)
}

switch service {
case .github:
print("Setting template for Github Actions")
fileManager.removeItems(in: "bitrise.yml")
fileManager.removeItems(in: "codemagic.yaml")
fileManager.removeItems(in: ".github/workflows")
fileManager.createDirectory(path: ".github/workflows")
fileManager.moveFiles(in: ".github/project_workflows", to: ".github/workflows")
fileManager.removeItems(in: ".github/project_workflows")
case .bitrise:
print("Setting template for Bitrise")
fileManager.removeItems(in: "codemagic.yaml")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import Foundation

struct SetUpInterface {

enum Interface {

case swiftUI, uiKit

init?(_ name: String) {
switch name.lowercased() {
case "s", "swiftui":
let name = name.lowercased()
if name == "s" || name == "swiftui" {
self = .swiftUI
case "u", "uikit":
} else if name == "u" || name == "uikit" {
self = .uiKit
default: return nil
} else {
return nil
}
}

Expand Down Expand Up @@ -40,7 +43,7 @@ struct SetUpInterface {
let folderName = interface.folderName

fileManager.moveFiles(in: "tuist/Interfaces/\(folderName)/Project", to: "")
fileManager.moveFiles(in: "tuist/Interfaces/\(folderName)/Sources", to: "TemplateApp/Sources")
fileManager.moveFiles(in: "tuist/Interfaces/\(folderName)/Sources", to: "\(projectName)/Sources")
fileManager.removeItems(in: "tuist/Interfaces")
}
}
Loading
Loading