GithubHelp home page GithubHelp logo

iOS 14 compatibility issues about store HOT 4 CLOSED

nylki avatar nylki commented on May 23, 2024
iOS 14 compatibility issues

from store.

Comments (4)

alexdrone avatar alexdrone commented on May 23, 2024

Have you tried by having the action type explicit - as in CounterAction.increase(amount: 1) ?

from store.

nylki avatar nylki commented on May 23, 2024

Thank you for the quick response alex! I followed your suggestion and tried it. It resolved those errors but created new ones:
Screenshot 2021-02-04 at 17 39 30

For reference, here is my full ContentView.swift:

//  ContentView.swift

import SwiftUI
import Store

struct Counter { var count = 0 }

enum CounterAction: Action {
  case increase(amount: Int)
  case decrease(amount: Int)

  func reduce(context: TransactionContext<Store<Counter>, Self>) {
    defer {
      context.fulfill()
    }
    switch self {
    case .increase(let amount):
      context.reduceModel { $0.count += amount }
    case .decrease(let amount):
      context.reduceModel { $0.count -= amount }
    }
  }

  func cancel(context: TransactionContext<Store<Counter>, Self>) { }
}


// MARK: - UI
struct ContentView: View {
    @StateObject var store = Store<Counter>(model: Counter())
    
    var body: some View {
//        Text("Text without Logic")
        Text("counter \(store.model.count)").onTapGesture {
            store.run(action: CounterAction.increase(amount: 1))
        }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView().background(Color.gray)
    }
}

from store.

alexdrone avatar alexdrone commented on May 23, 2024

Hi! sorry for the late reply :(

This is now fixed in Store 3.6

from store.

nylki avatar nylki commented on May 23, 2024

@alexdrone No worries, thanks!

from store.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.