-
Notifications
You must be signed in to change notification settings - Fork 0
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 #57 from shichimitoucarshi/fix/package
FIX
- Loading branch information
Showing
11 changed files
with
207 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "1540" | ||
version = "1.7"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES" | ||
buildArchitectures = "Automatic"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "ClimbBar" | ||
BuildableName = "ClimbBar" | ||
BlueprintName = "ClimbBar" | ||
ReferencedContainer = "container:"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
shouldAutocreateTestPlan = "YES"> | ||
</TestAction> | ||
<LaunchAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
debugServiceExtension = "internal" | ||
allowLocationSimulation = "YES"> | ||
</LaunchAction> | ||
<ProfileAction | ||
buildConfiguration = "Release" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
debugDocumentVersioning = "YES"> | ||
<MacroExpansion> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "ClimbBar" | ||
BuildableName = "ClimbBar" | ||
BlueprintName = "ClimbBar" | ||
ReferencedContainer = "container:"> | ||
</BuildableReference> | ||
</MacroExpansion> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
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
79 changes: 79 additions & 0 deletions
79
ClimbBarExample/ViewConntroller/CollectionView/NumberOfSelectedItems.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,79 @@ | ||
// | ||
// NumberOfSelectedItems.swift | ||
// ClimbBarExample | ||
// | ||
// Created by keisuke yamagishi on 2024/06/20. | ||
// Copyright © 2024 Shichimitoucarashi. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
class NumberOfSelectedItems { | ||
|
||
struct Item { | ||
let index: IndexPath | ||
var count: Int | ||
} | ||
|
||
var selectedOfNumber = 0 | ||
var selectedCells: [IndexPath] = [] | ||
var selectedItems: [Item] = [] | ||
|
||
func isSelectedItem(indexPath: IndexPath) -> Bool { | ||
selectedCells.contains(indexPath) | ||
} | ||
|
||
func didSelectedItem(indexPath: IndexPath) { | ||
if !selectedCells.contains(indexPath), | ||
selectedCells.count < 4 | ||
{ | ||
selectedCells.append(indexPath) | ||
selectedItems.append(Item(index: indexPath, | ||
count: selectedOfNumber)) | ||
selectedOfNumber += 1 | ||
} else { | ||
if let index = getIndex(indexPath: indexPath) { | ||
selectedCells.remove(at: index) | ||
selectedItems.remove(at: index) | ||
|
||
selectedItems.sort { | ||
$0.count < $1.count | ||
} | ||
|
||
var count = 0 | ||
var items: [Item] = [] | ||
selectedItems.forEach { | ||
items.append(Item(index: $0.index, count: count)) | ||
count += 1 | ||
} | ||
|
||
selectedItems = items | ||
|
||
selectedOfNumber -= 1 | ||
|
||
} else { | ||
|
||
} | ||
} | ||
} | ||
|
||
func getItem(_ indexPath: IndexPath) -> String? { | ||
for index in 0 ..< selectedItems.count { | ||
let selectedItem = selectedItems[index] | ||
if selectedItem.index == indexPath { | ||
return "\(selectedItem.count)" | ||
} | ||
} | ||
return nil | ||
} | ||
|
||
private func getIndex(indexPath: IndexPath) -> Int? { | ||
for index in 0 ..< selectedCells.count { | ||
let selectedIndexPath = selectedCells[index] | ||
if selectedIndexPath == indexPath { | ||
return index | ||
} | ||
} | ||
return nil | ||
} | ||
} |
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 |
---|---|---|
|
@@ -9,7 +9,6 @@ | |
import Foundation | ||
|
||
public extension ClimbBar.State { | ||
|
||
/* | ||
* scrollable object`s offset y | ||
*/ | ||
|
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
Oops, something went wrong.