内容简介:If you are a developer or designer, this repository is meant for you. Down below, I've listed all the features this demonstration app includes so you can learn more about a feature you're interested in implementing yourself.ALSO, please do this repository
ElegantTimeline
ElegantTimeline
is a SwiftUI demonstration of a multi-faceted timline view with interactions between the calendar, list, and app theme.
If you are a developer or designer, this repository is meant for you. Down below, I've listed all the features this demonstration app includes so you can learn more about a feature you're interested in implementing yourself.
ALSO, please do this repository justice and run it on an actual device. It will look so much more elegant with the bezels and rounded corners and run smoother as the simulator isn't suited for hardcore renders like deez. Also, the app will look better if you run it on an iPhone X or above. The list snaps to the nearest cell based on the top notch bezel. How cool is that.
The GIFs may take a while to load depending on your internet speed. If you want to view an individual GIF, just click it.
I'm also working on a new library called ElegantColorPicker . The eventual goal is to have the same effect as below. So watch that repository if you're interested.
Introduction
ElegantTimeline
is inspired by TimePage and is part of a larger repository of elegant demonstrations like this: TimePage Clone . It uses ElegantPages and ElegantCalendar , two libraries I wrote specifically for this demonstration.
Also, make sure to check out TimePrints , an app that I'm working on that'll utilize this UI for visits tracking. Funny thing is, I've been so busy developing the components that eventually be implemented inside my app that I haven't actually worked much on my app in the past month.
Features
Paging + Theme Change
What you can learn:
- Custom gestures for different page turns: the calendar has a different animation for its page turn than the other views
- The paging animation when you move from the list to the menu view: rounding the corners and decreasing the height of the list view
- This feature actually gave me a headache. If you actually try to round the corners of the list view itself, the list gets offset and all kinds of wack happens. I've actually reduced all the sideeffects by just layering a view with a transparent inner
RoundedRectangle
with its edges in black.
- This feature actually gave me a headache. If you actually try to round the corners of the list view itself, the list gets offset and all kinds of wack happens. I've actually reduced all the sideeffects by just layering a view with a transparent inner
- Use of
GestureMask
while paging - Animating and offsetting the monthly calendar properly to have that bit of list background showing to the right
- Overlaying the list and configuring opacity to achieve a smooth fade effect while paging
- Animating and rotating a partial screen menu
- The animation behind the theme change
- Propogation of new theme down to all subviews
Relevant code:
- HomeView : The root view that acts as the page view. You can command click into all the other views from here.
- ResizingOverlayView : The view behind the list to menu animation.
- PageScrollState : Logic behind different animations for different page turns
SideBar that tracks current month and year + Visits slideshow list + Weeks/Months ago popup
What you can learn:
- The SideBar really is just 2
Text
that are juggled depending on the current offset. So you can see the logic behind that - The list is really just a
UITableView
UIViewRepresentable@State
- The weeks/months ago popup relies heavily on the list logic, depending on whether the list is dragging or not, etc
Relevant code:
- MonthYearSideBar
- VisitsPreviewList :
UITableView
UIViewRepresentable. You can command click relevant views inside that struct. - FromTodayPopupView
Monthly Calendar and list interaction
What you can learn:
- The interaction
- When you scroll to a new month in the list, the calendar also scrolls to that same month
- When you scroll to a new month in the calendar, the list scrolls to the last day of that month
- When you tap a day in the calendar, the list scrolls to that day
- Learn which
UITableViewDelegate
methods to implement that make this really efficient- The calendar isn't scrolling to a new month everytime the list scrolls to a new month
- Only after the list stops scrolling does the calendar then scroll to the current month
- Swiping to a different page - the calendar or menu - is forbidden while scrolling in the list so you can look into the code to find out how that works
Relevant code:
- HomeManager : Handles the communication between the list and calendar
- ListScrollState : Implements the necessary
UITableViewDelegate
methods for this to work
Yearly Calendar and list interaction
What you can learn:
- The interaction
- When you tap a month in the yearly calendar, the monthly calendar switches over to that month and the list also scrolls ot the last day of that month
- This is great if you want to get to a date that's far away quick
- When you scroll to a new year in the list, the yearly calendar doesn't immediately scroll to that year
- Only after you scroll back to the yearly calendar does it scroll to that year
- When you tap a month in the yearly calendar, the monthly calendar switches over to that month and the list also scrolls ot the last day of that month
Relevant code:
- HomeManager : Handles the communication between the list and calendar
- ListScrollState : Implements the necessary
UITableViewDelegate
methods for this to work
Fast Scrolling
What you can learn:
- How it works
- Make sure you're on the list view. Start dragging the month-year sidebar in whichever direction you want to fast scroll in.
- Make sure that this gesture is entirely vertical because just a bit of horizontal translation will cease the fast scroll
- Just a very intuitive gesture that makes sense if the user doesn't feel like scrolling to the calendar
- The same calendar interactions apply here too: whatever month the fast scroll ends on is also the month the calendar scrolls to
- Learn about how custom scrolling is simulated in the list through interacting with the
contentOffset
of theUITableView
- There is a specific timing function needed in order to animate the custom scroll elegantly
- The fast scroll also snaps to whatever cell it ends near, in a smooth manner
Relevant code:
- ListScrollState : Exposes methods for fast scrolling and does all the business logic for fast scrolling
- VisitsTimelineView : Fast scrolling gesture originates here
Scrolling back to today
What you can learn:
- The custom scale animation that occurs when you tap the button and the fade out animation afterwards
- Logic behind scrolling to the current day and when to show the button
Relevant code:
- ScrollBackToTodayButton
- ListScrollState : Logic behind scrolling back to today
Header and footer quote
What you can learn:
- Just a pretty cool easter egg I added. Based off of the current list's scroll offset and whether it's scrolled past its edges or not
Relevant code:
Requirements
- iOS 13.0+
- Xcode 11.0+
Resources
Also, here's a dump of resources I found useful when working on this
License
This project is licensed under the MIT License - see the LICENSE file for details
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
实用Common Lisp编程
Peter Seibel / 田春 / 人民邮电出版社 / 2011-10 / 89.00元
由塞贝尔编著的《实用Common Lisp编程》是一本不同寻常的Common Lisp入门书。《实用Common Lisp编程》首先从作者的学习经过及语言历史出发,随后用21个章节讲述了各种基础知识,主要包括:REPL及Common Lisp的各种实现、S-表达式、函数与变量、标准宏与自定义宏、数字与字符以及字符串、集合与向量、列表处理、文件与文件I/O处理、类、FORMAT格式、符号与包,等等。......一起来看看 《实用Common Lisp编程》 这本书的介绍吧!