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

unexpectedly found nil while unwrapping an Optional value in TypeMaps #8

Open
seyhunak opened this issue Oct 14, 2016 · 0 comments
Open

Comments

@seyhunak
Copy link

seyhunak commented Oct 14, 2016

Hello,

I was getting "unexpectedly found nil while unwrapping an Optional value". in ReSwift-Recorder
What is the problem in code below?

AppDelegate

var store = RecordingMainStore<BaseState>(
    reducer: BaseReducer(),
    state: nil,
    typeMaps:[accountsActionTypeMap, ReSwiftRouter.typeMap],
    recording: "recording.json"
)

Actions

let accountsActionTypeMap: TypeMap = [AccountsListAction.type: AccountsListAction.self,
                                      AccountDetailAction.type: AccountDetailAction.self,
                                      AccountIdentifierAction.type: AccountIdentifierAction.self]

struct AccountsListAction: StandardActionConvertible {
    static let type = "ACCOUNTS_LIST_ACTION"
    var accounts: [IdentifiersResponse]?
    init(accounts: [IdentifiersResponse]) { self.accounts = accounts }

    init() {}
    init(_ standardAction: StandardAction) {
        self.accounts = [IdentifiersResponse]()
    }

    func toStandardAction() -> StandardAction {
        return StandardAction(type: AccountsListAction.type,
                              payload: ["accounts": accounts as! AnyObject],
                              isTypedAction: true)
    }
}

Stack trace (RecordingStore.swift: 145)

screen shot 2016-10-14 at 22 15 33

Using ReSwift (2.1.0)
Using ReSwiftRecorder (0.3.0)
Using ReSwiftRouter (0.3.0)

Xcode 7.3
Swift 2.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant