Skip to content

Commit

Permalink
Merge pull request #363 from kvyatkovskys/feature/v_0.6.24
Browse files Browse the repository at this point in the history
version up 0.6.24
  • Loading branch information
kvyatkovskys authored Jul 6, 2024
2 parents 5e19b14 + 71e068d commit fbf1c75
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 62 deletions.
22 changes: 12 additions & 10 deletions Example/KVKCalendar.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,9 @@
607FACC81AFB9204008FA782 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 1320;
LastUpgradeCheck = 1600;
ORGANIZATIONNAME = CocoaPods;
TargetAttributes = {
607FACCF1AFB9204008FA782 = {
Expand All @@ -296,9 +297,6 @@
LastSwiftMigration = 1020;
TestTargetID = 607FACCF1AFB9204008FA782;
};
F9E6F6F8281F0C13000AEADD = {
DevelopmentTeam = H2NQL66JNC;
};
};
};
buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "KVKCalendar" */;
Expand Down Expand Up @@ -557,6 +555,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -615,6 +614,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -668,8 +668,9 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = KVKCalendar_Example.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = NO;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = P44LMMDHV3;
INFOPLIST_FILE = KVKCalendar/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.developer-tools";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
Expand All @@ -695,8 +696,9 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = KVKCalendar_Example.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = NO;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = P44LMMDHV3;
INFOPLIST_FILE = KVKCalendar/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.developer-tools";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
Expand All @@ -720,7 +722,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 3D1741B81199E2ED13C0E0BC /* Pods-KVKCalendar_Tests.debug.xcconfig */;
buildSettings = {
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = P44LMMDHV3;
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
Expand All @@ -746,7 +748,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = BBA5555F4434EF626F6DCFF0 /* Pods-KVKCalendar_Tests.release.xcconfig */;
buildSettings = {
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = P44LMMDHV3;
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
Expand All @@ -771,7 +773,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = KVKCalendar_Example.entitlements;
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
DEVELOPMENT_TEAM = H2NQL66JNC;
DEVELOPMENT_TEAM = P44LMMDHV3;
INFOPLIST_FILE = "$(SRCROOT)/KVKCalendar_Example_SwiftUI-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.2;
Expand All @@ -798,7 +800,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = KVKCalendar_Example.entitlements;
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
DEVELOPMENT_TEAM = H2NQL66JNC;
DEVELOPMENT_TEAM = P44LMMDHV3;
INFOPLIST_FILE = "$(SRCROOT)/KVKCalendar_Example_SwiftUI-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.2;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1400"
LastUpgradeVersion = "1600"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1400"
LastUpgradeVersion = "1600"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion KVKCalendar.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'KVKCalendar'
s.version = '0.6.23'
s.version = '0.6.24'
s.summary = 'A most fully customization calendar for Apple platforms.'

s.description = <<-DESC
Expand Down
40 changes: 12 additions & 28 deletions Sources/KVKCalendar/Calendar+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ extension UIRectCorner {

}

public protocol KVKCellIdentifierProxy: AnyObject {
protocol KVKCellIdentifierProxy: AnyObject {

static var kvkIdentifier: String { get }

Expand All @@ -312,33 +312,13 @@ extension UIView: KVKCellIdentifierProxy {

public protocol KVKDequeueProxyProtocol: AnyObject {}

//public extension KVKDequeueProxyProtocol {
//
// func kvkDequeueCell<T, U: KVKCellIdentifierProxy>(type: CalendarType,
// view: T,
// id: String = U.kvkIdentifier,
// indexPath: IndexPath? = nil,
// configure: (U) -> Void) -> U? {
// switch type {
//
// case .month:
// if let cell = (view as? UITableView)?.kvkDequeueCell(id: id,
// indexPath: indexPath,
// configure: configure) {
// return cell
// } else {
// return nil
// }
// default:
// return nil
// }
// }
//
//}

public extension KVKDequeueProxyProtocol where Self: UITableView {

func kvkDequeueCell<T: UITableViewCell>(id: String = T.kvkIdentifier, indexPath: IndexPath? = nil, configure: (T) -> Void) -> T {
func kvkDequeueCell<T: UITableViewCell>(
id: String = T.kvkIdentifier,
indexPath: IndexPath? = nil,
configure: (T) -> Void
) -> T {
kvkRegister(T.self)

let cell: T
Expand Down Expand Up @@ -372,7 +352,11 @@ public extension KVKDequeueProxyProtocol where Self: UITableView {

public extension KVKDequeueProxyProtocol where Self: UICollectionView {

func kvkDequeueCell<T: UICollectionViewCell>(id: String = T.kvkIdentifier, indexPath: IndexPath, configure: (T) -> Void) -> T {
func kvkDequeueCell<T: UICollectionViewCell>(
id: String = T.kvkIdentifier,
indexPath: IndexPath,
configure: (T) -> Void
) -> T {
kvkRegister(T.self, id: id)

let cell: T
Expand Down Expand Up @@ -406,7 +390,7 @@ extension UITableView: KVKDequeueProxyProtocol {}
extension UICollectionView: KVKDequeueProxyProtocol {}

@available(iOS 13.4, *)
extension UIView: UIPointerInteractionDelegate {
extension UIView: @retroactive UIPointerInteractionDelegate {

func addPointInteraction() {
let interaction = UIPointerInteraction(delegate: self)
Expand Down
1 change: 1 addition & 0 deletions Sources/KVKCalendar/DayView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public final class DayView: UIView {
}

func reloadData(_ events: [Event]) {
scrollableWeekView.reloadCustomCornerHeaderViewIfNeeded()
parameters.data.recurringEvents = events.filter { $0.recurringType != .none }
parameters.data.events = parameters.data.filterEvents(events, date: parameters.data.date)
timelinePage.timelineView?.create(dates: [parameters.data.date],
Expand Down
17 changes: 8 additions & 9 deletions Sources/KVKCalendar/KVKCalendarView+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,15 @@ extension KVKCalendarView {
case .authorized:
completion(true)
default:
// temporary disabled
// if #available(iOS 17.0, *) {
// store.requestFullAccessToEvents { (access, error) in
// proxyCompletion(access: access, status: status, error: error)
// }
// } else {
store.requestAccess(to: .event) { (access, error) in
proxyCompletion(access: access, status: status, error: error)
if #available(iOS 17.0, *) {
store.requestFullAccessToEvents { (access, error) in
proxyCompletion(access: access, status: status, error: error)
}
} else {
store.requestAccess(to: .event) { (access, error) in
proxyCompletion(access: access, status: status, error: error)
}
}
// }
}
}

Expand Down
33 changes: 26 additions & 7 deletions Sources/KVKCalendar/ScrollableWeekView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ final class ScrollableWeekView: UIView {
layout.scrollDirection = .horizontal
return layout
}()

private let customCornerHeaderViewTag = -1001
private var titleView: ScrollableWeekHeaderTitleView?
private let bottomLineView = UIView()
private let cornerBtn: UIButton = {
Expand Down Expand Up @@ -198,7 +198,7 @@ extension ScrollableWeekView: CalendarSettingProtocol {
}
}

func setUI(relad: Bool = false) {
func setUI(reload: Bool = false) {
bottomLineView.backgroundColor = params.style.headerScroll.bottomLineColor

subviews.forEach { $0.removeFromSuperview() }
Expand Down Expand Up @@ -234,17 +234,36 @@ extension ScrollableWeekView: CalendarSettingProtocol {
scrollToDate(date, animated: true)
}

func reloadCustomCornerHeaderViewIfNeeded() {
if let cornerHeader = dataSource?.dequeueCornerHeader(
date: date,
frame: CGRect(x: 0, y: 0,
width: leftOffsetWithAdditionalTime,
height: bounds.height),
type: type
) {
cornerHeader.tag = customCornerHeaderViewTag
for subview in subviews where subview.tag == customCornerHeaderViewTag {
subview.removeFromSuperview()
}
addSubview(cornerHeader)
}
}

private func setupViews(mainFrame: inout CGRect) {
if let customView = dataSource?.willDisplayHeaderView(date: date, frame: mainFrame, type: type) {
params.weeks = []
collectionView.reloadData()
addSubview(customView)
} else {
if let cornerHeader = dataSource?.dequeueCornerHeader(date: date,
frame: CGRect(x: 0, y: 0,
width: leftOffsetWithAdditionalTime,
height: bounds.height),
type: type) {
if let cornerHeader = dataSource?.dequeueCornerHeader(
date: date,
frame: CGRect(x: 0, y: 0,
width: leftOffsetWithAdditionalTime,
height: bounds.height),
type: type
) {
cornerHeader.tag = customCornerHeaderViewTag
addSubview(cornerHeader)
mainFrame.origin.x = cornerHeader.frame.width
mainFrame.size.width -= cornerHeader.frame.width
Expand Down
8 changes: 4 additions & 4 deletions Sources/KVKCalendar/SwiftUI+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,16 @@ struct ItemsMenu_Previews: PreviewProvider {
}
}

public struct StatefulPreviewWrapper<Value, Content: View>: View {
struct StatefulPreviewWrapper<Value, Content: View>: View {
@State var value: Value
var content: (Binding<Value>) -> Content

public var body: some View {
var body: some View {
content($value)
}

public init(_ value: Value,
content: @escaping (Binding<Value>) -> Content) {
init(_ value: Value,
content: @escaping (Binding<Value>) -> Content) {
self._value = State(wrappedValue: value)
self.content = content
}
Expand Down
1 change: 1 addition & 0 deletions Sources/KVKCalendar/WeekView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ final class WeekView: UIView {
}

func reloadData(_ events: [Event]) {
scrollableWeekView.reloadCustomCornerHeaderViewIfNeeded()
parameters.data.recurringEvents = events.filter { $0.recurringType != .none }
parameters.data.events = parameters.data.filterEvents(events, dates: parameters.visibleDates)
timelinePage.timelineView?.create(dates: parameters.visibleDates,
Expand Down

0 comments on commit fbf1c75

Please sign in to comment.