-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from carousell/feature/photo-albums-layout
Photo Albums Layout
- Loading branch information
Showing
11 changed files
with
301 additions
and
210 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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// | ||
// This source file is part of the carousell/pickle open source project | ||
// | ||
// Copyright © 2017 Carousell and the project authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See https://github.com/carousell/pickle/blob/master/LICENSE for license information | ||
// See https://github.com/carousell/pickle/graphs/contributors for the list of project authors | ||
// | ||
|
||
import UIKit | ||
|
||
internal final class PhotoAlbumsTableView: UITableView { | ||
|
||
// MARK: - Initialization | ||
|
||
convenience init(configuration: ImagePickerConfigurable? = nil) { | ||
self.init(frame: .zero, style: .plain) | ||
|
||
let color = configuration?.photoAlbumsNavigationBarShadowColor | ||
guard color != .clear else { | ||
return | ||
} | ||
|
||
layer.addSublayer(shadawLayer) | ||
shadawLayer.borderColor = color?.cgColor ?? UIColor.Palette.magnesium.cgColor | ||
} | ||
|
||
// MARK: - Properties | ||
|
||
private var _shadawLayer: CALayer? | ||
|
||
private var shadawLayer: CALayer { | ||
if let instantiated = _shadawLayer { | ||
return instantiated | ||
} | ||
|
||
let layer = CALayer() | ||
layer.borderWidth = 1 / UIScreen.main.scale | ||
layer.rasterizationScale = UIScreen.main.scale | ||
layer.shouldRasterize = true | ||
|
||
_shadawLayer = layer | ||
return layer | ||
} | ||
|
||
// MARK: - UIView | ||
|
||
override var frame: CGRect { | ||
didSet { | ||
_shadawLayer?.frame = bounds.insetBy(dx: -1, dy: -1).offsetBy(dx: 0, dy: 1) | ||
} | ||
} | ||
|
||
} |
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