Skip to content

kokonak/SlidingPuzzleView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SlidingPuzzleView

Language Platform iOS License

About

SlidingPuzzleView is a simple view written in Swift for implementing a sliding puzzle. Create a view, set a couple properties and execute. startPuzzle()!

Usage

  • Properties must set before executing startPuzzle()
  • SlidingPuzzleView frame width and height must be equal.
let width: CGFloat = 300
let puzzleView: SlidingPuzzleView = SlidingPuzzleView(frame: CGRect(0, 0, width, width))
puzzleView.level = .normal
puzzleView.puzzleImage = UIImage(named: "image")
puzzleView.delegate = self

puzzleView.startPuzzle()

Properties

Property Type Description
pieceBorderColor UIColor Piece border color
pieceBorderWidth CGFloat Piece border width
level puzzleLevel 4 difficulty levels. veryEasy(2 x 2), easy(3 x 3), normal(4 x 4), hard(5 x 5)
swapDuration Double Duration for swap animation
puzzleImage UIImage Image for puzzle
delegate puzzleDelegate Delegate (puzzleComplete, puzzleSwapCount)
swapCount Int The number of times that the user has moved a piece.

Author

kokonak, kokonak7@gmail.com

License

SlidingPuzzleView is available under the MIT license. See the LICENSE file for more info.

About

Simple SlidingPuzzleView

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages