-
-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New modifier to change content loading policy
- Loading branch information
Fernando Moya de Rivas
committed
Jul 5, 2020
1 parent
a0cab66
commit 298378f
Showing
9 changed files
with
100 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
Sources/SwiftUIPager/PageConfiguration/ContentLoadingPolicy.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Fernando Moya de Rivas on 05/07/2020. | ||
// | ||
|
||
import Foundation | ||
|
||
/// Policy to follow when loading content | ||
public enum ContentLoadingPolicy: Equatable { | ||
|
||
/// Content is loaded on demand by applying a recycling the ratio. | ||
/// | ||
/// - Parameter recyclingRatio: Manages the number of items that should be displayed in the screen. | ||
/// | ||
/// A ratio of `5`, for instance, will load enough items in memory to fill five times the size of `Pager`. | ||
/// - Note: `recyclingRatio` must be greather than `0`. | ||
case lazy(recyclingRatio: UInt) | ||
|
||
/// Choose `eager` to load all items at once | ||
case eager | ||
|
||
/// Default policy, a.k.a, `lazy(recyclingRatio: 5)` | ||
static var `default`: ContentLoadingPolicy = .lazy(recyclingRatio: 5) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters