Giter VIP home page Giter VIP logo

Comments (13)

kylebrowning avatar kylebrowning commented on May 29, 2024

Im getting this as well. @nicksnyder

from layoutkit.

jingwei-huang1 avatar jingwei-huang1 commented on May 29, 2024

Hi Kyle, thanks for your feedback. Could you please provide the more information about this error? Is it a crash? Can you reproduce it every time? When does this happen? Which version of Xcode and simulator are you using?

from layoutkit.

kylebrowning avatar kylebrowning commented on May 29, 2024

Using code from the Sample, in a new Xcode project, Xcode 8.3 and Simulator iOS 10.3

class FeedCollectionViewController: UIViewController {

    private var reloadableViewLayoutAdapter: ReloadableViewLayoutAdapter!
    private var collectionView: UICollectionView!

    override func viewDidLoad() {
        super.viewDidLoad()

        collectionView = UICollectionView(frame: view.bounds, collectionViewLayout: UICollectionViewFlowLayout())
        collectionView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
        collectionView.backgroundColor = UIColor.purple

        reloadableViewLayoutAdapter = ReloadableViewLayoutAdapter(reloadableView: collectionView)
        collectionView.dataSource = reloadableViewLayoutAdapter
        collectionView.delegate = reloadableViewLayoutAdapter

        view.addSubview(collectionView)
        self.layoutFeed(width: collectionView.frame.width, synchronous: false)
    }

    private func layoutFeed(width: CGFloat, synchronous: Bool) {
        reloadableViewLayoutAdapter.reload(width: width, synchronous: synchronous, layoutProvider: { [weak self] in
            return [Section(header: nil, items: self?.getFeedItems() ?? [], footer: nil)]
        })
    }

    override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
        super.viewWillTransition(to: size, with: coordinator)
        layoutFeed(width: size.width, synchronous: true)
    }
}

I get the following errors

1: Extra argument 'synchronous' in call

Which refers to this line,

  reloadableViewLayoutAdapter.reload(width: width, synchronous: synchronous, layoutProvider: { [weak self] in
            return [Section(header: nil, items: self?.getFeedItems() ?? [], footer: nil)]
        })

from layoutkit.

jingwei-huang1 avatar jingwei-huang1 commented on May 29, 2024

In the example code, FeedCollectionViewController extends from FeedBaseViewController. In base class FeedBaseViewController, getFeedItems() provides an array of Layout. Since your FeedCollectionViewController is subclass of UIViewController, could you post your getFeedItems()?

from layoutkit.

staguer avatar staguer commented on May 29, 2024

@kylebrowning So the sample app builds successfully for you but when copied to a new project the code no longer builds?

from layoutkit.

kylebrowning avatar kylebrowning commented on May 29, 2024

@staguer Correct.

I changed self?.getFeedItems() to be a custom array of my layouts as well.

from layoutkit.

kylebrowning avatar kylebrowning commented on May 29, 2024

CC @jingwei-huang1 ^

from layoutkit.

kylebrowning avatar kylebrowning commented on May 29, 2024

It appears to not like my use of generics.

class CommonTableViewController<Item>: UIViewController {
    var items: [Item] = []

from layoutkit.

jingwei-huang1 avatar jingwei-huang1 commented on May 29, 2024

@kylebrowning For layoutProvider, it has to be (Void) -> T. For the generics we are using, please refer to public struct Section<C: Collection>. And also you can take a look on the existed example of layoutProvider in func layoutOne() -> [Section<[Layout]>].

Please let us know if that resolves your issue.

from layoutkit.

kylebrowning avatar kylebrowning commented on May 29, 2024

Will do, Ill let you know.

from layoutkit.

AlexBlack559 avatar AlexBlack559 commented on May 29, 2024

Same issue. Works well in example project but when I try to call this method from my project i get the same error.

from layoutkit.

AlexBlack559 avatar AlexBlack559 commented on May 29, 2024

Solved by putting ?? [] after self?.getFeedItems() still don't understand why this is causing the problem though. My getFeedItems method returns [Layout] array.

from layoutkit.

aputinski avatar aputinski commented on May 29, 2024

Im getting Extra argument 'synchronous' in call with the following code:

adapter.reload(
  width: 100,
  synchronous: true,
  layoutProvider: {
    return [
      Section(
        header: nil,
        items: [LabelLayout(text: "Hello", config: { _ in })],
        footer: nil
      )
    ]
  }
)

from layoutkit.

Related Issues (20)

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.