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

Fix package name conflict #8

Open
wants to merge 3 commits into
base: stable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import MungoHealer
import UIKit

var mungo: MungoHealer!
var mungo: Mungo!

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
Expand All @@ -19,7 +19,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

private func configureMungoHealer() {
let errorHandler = AlertLogErrorHandler(window: window!, logError: { print("Error: \($0)") })
mungo = MungoHealer(errorHandler: errorHandler)
mungo = Mungo(errorHandler: errorHandler)
}
}

2 changes: 1 addition & 1 deletion Frameworks/MungoHealer/Globals/Globals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
import Foundation

func LocalizedString(_ key: String) -> String { // swiftlint:disable:this identifier_name
return NSLocalizedString(key, tableName: nil, bundle: Bundle(for: MungoHealer.self), value: "", comment: "")
return NSLocalizedString(key, tableName: nil, bundle: Bundle(for: Mungo.self), value: "", comment: "")
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import Foundation

/// The main error handler.
public class MungoHealer {
public class Mungo {
private let errorHandler: ErrorHandler

/// Creates a new MungoHealer object with the given handlers.
Expand Down
12 changes: 6 additions & 6 deletions MungoHealer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
825D64CC2174AFCB007A3ED3 /* MungoHealer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 825D64CB2174AFCB007A3ED3 /* MungoHealer.swift */; };
825D64CE2174AFCB007A3ED3 /* MungoHealer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 825D64CB2174AFCB007A3ED3 /* MungoHealer.swift */; };
825D64CC2174AFCB007A3ED3 /* Mungo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 825D64CB2174AFCB007A3ED3 /* Mungo.swift */; };
825D64CE2174AFCB007A3ED3 /* Mungo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 825D64CB2174AFCB007A3ED3 /* Mungo.swift */; };
825D64DC2174B888007A3ED3 /* BaseError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 825D64DB2174B888007A3ED3 /* BaseError.swift */; };
825D64DE2174B888007A3ED3 /* BaseError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 825D64DB2174B888007A3ED3 /* BaseError.swift */; };
825D64E12174BB1C007A3ED3 /* FatalError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 825D64E02174BB1C007A3ED3 /* FatalError.swift */; };
Expand Down Expand Up @@ -98,7 +98,7 @@
0085926E2046FD1B00AB529F /* beak.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = beak.swift; sourceTree = "<group>"; };
820560AE217DE97100E23A81 /* CONTRIBUTING.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CONTRIBUTING.md; sourceTree = "<group>"; };
820560AF217DE97100E23A81 /* CODE_OF_CONDUCT.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CODE_OF_CONDUCT.md; sourceTree = "<group>"; };
825D64CB2174AFCB007A3ED3 /* MungoHealer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MungoHealer.swift; sourceTree = "<group>"; };
825D64CB2174AFCB007A3ED3 /* Mungo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Mungo.swift; sourceTree = "<group>"; };
825D64D02174B1CB007A3ED3 /* .projlint.yml */ = {isa = PBXFileReference; lastKnownFileType = text; path = .projlint.yml; sourceTree = "<group>"; };
825D64D52174B388007A3ED3 /* CHANGELOG.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CHANGELOG.md; sourceTree = "<group>"; };
825D64DB2174B888007A3ED3 /* BaseError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseError.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -270,7 +270,7 @@
A102BDA01F02387A000C6B38 /* MungoHealer */ = {
isa = PBXGroup;
children = (
825D64CB2174AFCB007A3ED3 /* MungoHealer.swift */,
825D64CB2174AFCB007A3ED3 /* Mungo.swift */,
825D65132174D2D6007A3ED3 /* ErrorHandlers */,
82C646E121762A4C00A41245 /* ErrorTypes */,
825D65112174D1FD007A3ED3 /* ErrorsProtocols */,
Expand Down Expand Up @@ -680,7 +680,7 @@
82C646E621762B7500A41245 /* MungoFatalError.swift in Sources */,
82C646E321762A9B00A41245 /* MungoError.swift in Sources */,
825D64E12174BB1C007A3ED3 /* FatalError.swift in Sources */,
825D64CC2174AFCB007A3ED3 /* MungoHealer.swift in Sources */,
825D64CC2174AFCB007A3ED3 /* Mungo.swift in Sources */,
825D650F2174C67D007A3ED3 /* HealingOption.swift in Sources */,
825D651C2174D570007A3ED3 /* UIWindowExtension.swift in Sources */,
82C646E921762B7F00A41245 /* MungoHealableError.swift in Sources */,
Expand Down Expand Up @@ -709,7 +709,7 @@
82C646E721762B7500A41245 /* MungoFatalError.swift in Sources */,
82C646E421762A9B00A41245 /* MungoError.swift in Sources */,
825D64E32174BB1C007A3ED3 /* FatalError.swift in Sources */,
825D64CE2174AFCB007A3ED3 /* MungoHealer.swift in Sources */,
825D64CE2174AFCB007A3ED3 /* Mungo.swift in Sources */,
825D65102174C67D007A3ED3 /* HealingOption.swift in Sources */,
825D651D2174D570007A3ED3 /* UIWindowExtension.swift in Sources */,
82C646EA21762B7F00A41245 /* MungoHealableError.swift in Sources */,
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ The easiest way to get started with MungoHealer is to use a global variable and
import MungoHealer
import UIKit

var mungo: MungoHealer!
var mungo: Mungo!

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
Expand All @@ -317,15 +317,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

private func configureMungoHealer() {
let errorHandler = AlertLogErrorHandler(window: window!, logError: { print("Error: \($0)") })
mungo = MungoHealer(errorHandler: errorHandler)
mungo = Mungo(errorHandler: errorHandler)
}
}
```

Note that the following steps were taken in the above code:

1. Add `import MungoHealer` at the top
2. Add `var mungo: MungoHealer!` global variable
2. Add `var mungo: Mungo!` global variable
3. Add a private `configureMungoHealer()` method
4. Provide your preferred `logError` handler (e.g. [SwiftyBeaver](https://github.com/SwiftyBeaver/SwiftyBeaver))
5. Call `configureMungoHealer()` on app launch
Expand All @@ -343,12 +343,12 @@ While starting with the `AlertLogErrorHandler` is recommended by default, you mi

See the implementation of `AlertLogErrorHandler` [here](https://github.com/JamitLabs/MungoHealer/blob/stable/Frameworks/MungoHealer/ErrorHandlers/AlertLogErrorHandler.swift) for a working example.

Note that you don't have to use a single global variable named `mungo` as in the example above. You could also write your own Singleton with multiple `MungoHealer` objects, each with a different `ErrorHandler` type. This way you could choose to either show an alert or your custom handling, depending on the context. The Singleton might look something like this:
Note that you don't have to use a single global variable named `mungo` as in the example above. You could also write your own Singleton with multiple `Mungo` objects, each with a different `ErrorHandler` type. This way you could choose to either show an alert or your custom handling, depending on the context. The Singleton might look something like this:

```swift
enum ErrorHandling {
static var alertLogHandler: MungoHealer!
static var myCustomHandler: MungoHealer!
static var alertLogHandler: Mungo!
static var myCustomHandler: Mungo!
}
```

Expand Down