Git Product home page Git Product logo

acarousel's Introduction

Hi there 👋

Top Langs

acarousel's People

Contributors

jwautumn avatar krin-san avatar theauttom avatar thitran-incepit avatar underthestars-zhy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

acarousel's Issues

View text becomes stretch

View text becomes stretched when scrolling and if I set the test with font size then top view text ok but scroll view text looks stretched

Show one and half image in frame

I've been playing around trying to figure out how I could get a full image (image 1) and half of the next image (image 2) to show before scrolling completely over to see image 2? Hope that made sense?

Autoscroll doesn't make sense.

The autoScrolling feature in your code using .defaultActive should rotate from A, B, C, A, B C without jumping back to A from C. It should just be continous.

Rotary Type Carousel

How to achieve the Rotary type Carousel present in the iCarousel Framework?

I wanted to achieve the below carousel view

Test
.

below is what I have
169468935-31bec645-095f-4d1b-807a-89fd4a9a5b06

GeometryReader包裹ACarousel时会产生一条空白区域(如图所示),但是包裹Image不会产生横线,请问如何去掉该空白区域。代码分别如下所示。

GeometryReader包裹ACarousel时会产生一条空白区域(如图所示),但是包裹Image不会产生横线,请问如何去掉该空白区域。代码分别如下所示。

/// GeometryReader下为Image时,效果正常,无空白区域
struct StickyDetailImageView: View {

var body: some View {
    ScrollView(.vertical, showsIndicators: false) {
        GeometryReader { geometry in
            Image("ic_img_placeholder")
                .resizable()
                .scaledToFill()
                .clipped()
                .frame(width: geometry.size.width, height: 250)
        }
        .frame(height: 250)
        .background(.blue)
        
        Text("GeometryReader下为Image时,效果正常,无空白区域").frame(width: UIScreen.main.bounds.width, height: 300).background(.green)
    }
    .ignoresSafeArea()
}

}

/// GeometryReader下为ACarousel时,效果异常,GeometryReader下会产生一条空白区域
struct StickyDetailACarouselView: View {

let lstBannerData: [DataResBean] = [DataResBean(id: 1, url: "ic_img_placeholder"), DataResBean(id: 2, url: "AppIcon"), DataResBean(id: 3, url: "ic_qrcode_app_download")]
@State var currentBannerIndex = 0

var body: some View {
    ScrollView(.vertical, showsIndicators: false) {
        GeometryReader { geometry in
            ACarousel(lstBannerData,
                      index: $currentBannerIndex,
                      spacing: 0,
                      headspace: 0,
                      sidesScaling: 1.0,
                      isWrap: true,
                      autoScroll: .inactive) { item in
                
                Image(item.url)
                    .resizable()
                    .scaledToFill()
                    .frame(width: geometry.size.width, height: .none)
                
            }
          .frame(width: geometry.size.width, height: 250)
          .background(.red)
          .onTapGesture {
              print(geometry.frame(in: .global).minY)
          }
        }
        .frame(height: 250)
        .background(.blue)
        
        Text("GeometryReader下为ACarousel时,效果异常,GeometryReader下会产生一条空白区域").frame(width: UIScreen.main.bounds.width, height: 300).background(.green)
    }
    .ignoresSafeArea()
}

}
WX20221027-235753@2x

Swipe speed

Is there a way to make the transition to the next slide faster?

Need access to identify current Item

@TheAuttom
@JWAutumn
It's an awesome library for this feature, First in SwiftUI I think.
However there is an improvement that will make it more useful.

There is no way to access the information what object is currently in Focus.
a) In case of Auto Scrolling turned ON
b) In case of Auto Scrolling turned OFF and user is manually dragging etc.

There is an AState Observable Object but it is set to private. Can you please provide a way to get that information?

Scrolling issue, if the item view is scrollview

because my item content is too long, so I need to add the scrollview in the top level of my content view, like that:

ACarousel(pages) { page in
ScrollView(.vertical) {
VStack{...}
}
}

but if you scroll a little right-down, it will show around 10-20px padding in right side. I already set the space & headSpace to 0
also does not work.

how to fix it?
thanks

dragGesture 超過所設置的高度

我使用以下 Code:
ACarousel(urls, id: \.self, index: $bannerIndex, spacing: 10, headspace: 10, sidesScaling: 0.8, isWrap: true, autoScroll: .active(3)) { url in BannerNetworkImage(urlString: url) .frame(height: 150) .cornerRadius(10) } .frame(height: 150)
但是滑動範圍超過了高度 150,可否修正呢?
因為這樣的話造成使用者不小心滑動到 (手沒在圖片上 依然可以滑動,似乎是全畫面手勢??)

例如我設置 150

但是在圖片的下緣 約高度 160 還是可滑動 .... !?

以上您的範例也可以重現

what should the index be when there are no items?

i’m having a crash in this library and i can’t seem to pinpoint it.

i have dynamic data so it can also have zero items.

in this case what seems to be the only working thing is to set the index to -1, but i’m not sure if it’s the right way.

RTL support

any suggestions on how to add Right-to-left support for Localization.

what should the index be when there are no items?

i’m having a crash in this library and i can’t seem to pinpoint it.

i have dynamic data so it can also have zero items.

in this case what seems to be the only working thing is to set the index to -1, but i’m not sure if it’s the right way.

#7	0x0000000100861948 in closure #1 in closure #1 in ACarousel.generateContent(proxy:) ()

this is what i can get.

some warming

import SwiftUI
import ACarousel

struct testModel: Identifiable {
let id: UUID = UUID()
let title: String

}

struct PlanListBannerView: View {
let items: [testModel] = [testModel(title: "123"), testModel(title: "234"), testModel(title: "345")]
@State var index: Int = 0
var body: some View {
ACarousel(items,
index: $index,
spacing: 16,
headspace: 10,
sidesScaling: 0.8,
isWrap: true,
autoScroll: .active(5)) { item in
Text(item.title)
}.frame(height: 160)
.border(.black, width: 1)

}

}

struct PlanListBannerView_Previews: PreviewProvider {
static var previews: some View {
PlanListBannerView()

}

}

run this code on iPhone 11, Xcode 13.2.1
it will appear something like this, how fix it?

ForEach<Array, UUID, ModifiedContent<ModifiedContent<Text, _FrameLayout>, _ScaleEffect>>: the ID 39C04D53-1D36-4AA6-B765-2A34FFB78DE7 occurs multiple times within the collection, this will give undefined results!
ForEach<Array, UUID, ModifiedContent<ModifiedContent<Text, _FrameLayout>, _ScaleEffect>>: the ID E36F64ED-93BF-46B5-ADAB-9B087D8F7CC3 occurs multiple times within the collection, this will give undefined results!
0.0
ForEach<Array, UUID, ModifiedContent<ModifiedContent<Text, _FrameLayout>, _ScaleEffect>>: the ID C6E86B38-1956-473C-AF9F-96A81F878561 occurs multiple times within the collection, this will give undefined results!
ForEach<Array, UUID, ModifiedContent<ModifiedContent<Text, _FrameLayout>, _ScaleEffect>>: the ID E2817A77-5311-4F80-8AEF-5816AB86C0EC occurs multiple times within the collection, this will give undefined results!

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.