Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DualMagneticFields #48

Open
wants to merge 58 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
2dfea09
Fix crash when image is nil (#10)
mlight3 May 12, 2017
3b3a826
backup
lasha-ring May 12, 2017
79385c1
Merge branch 'master' of https://github.com/efremidze/Magnetic
lasha-ring May 12, 2017
87b1d47
Added SKMultilineLabelNode
lasha-ring May 12, 2017
e4bdb61
backup
lasha-ring May 12, 2017
bcef50d
backup
lasha-ring May 12, 2017
a35b5f2
1.0.5
lasha-ring May 12, 2017
92d89b7
1.0.6
efremidze May 14, 2017
7175293
Update README.md
lasha-ring May 24, 2017
3fce3ba
Update README.md
lasha-ring May 25, 2017
948c7fd
Added Swift 4 branch
efremidze Jun 17, 2017
238927e
- Reconfig physics of Magnetic when size is changed (#15)
mlight3 Jun 20, 2017
53857f2
Update Magnetic.swift
lasha-ring Jun 20, 2017
ea269df
Autolayout fix (#16)
lasha-ring Jun 20, 2017
546f37a
1.0.7
lasha-ring Jul 25, 2017
8b53c41
1.0.8
lasha-ring Sep 5, 2017
99bfd10
Fix invalid physicsBody rect (#24)
mlight3 Sep 5, 2017
ed46c20
2.0.0
efremidze Sep 20, 2017
0f0674a
Update README.md
lasha-ring Sep 20, 2017
c132d87
Update README.md
lasha-ring Sep 20, 2017
89a4ea1
Added logo
efremidze Oct 10, 2017
dcbe09f
Create ISSUE_TEMPLATE.md
lasha-ring Oct 14, 2017
58bcf6e
Create CONTRIBUTING.md
lasha-ring Oct 14, 2017
0be5795
Create CODE_OF_CONDUCT.md
lasha-ring Oct 14, 2017
e06a1aa
Update CONTRIBUTING.md
lasha-ring Oct 14, 2017
a9725e8
Create PULL_REQUEST_TEMPLATE.md
lasha-ring Oct 14, 2017
0db01d8
Update README.md
lasha-ring Oct 17, 2017
3e9eb49
Fixed Xcode 9.1 warning (#33)
JoniVR Oct 28, 2017
8c86c78
2.0.1
efremidze Nov 21, 2017
37208a8
Update CONTRIBUTING.md
lasha-ring Dec 5, 2017
f0d606d
2.0.2
lasha-ring Dec 6, 2017
14a06c1
Renaming
lasha-ring Dec 6, 2017
c63c120
2.0.3
lasha-ring Dec 11, 2017
9ee8459
2.0.4
lasha-ring Dec 14, 2017
bcce360
Update README.md
lasha-ring Dec 24, 2017
0c57550
2.0.5
Feb 12, 2018
83c5440
Add custom physics body path
Feb 12, 2018
fd53a72
fix removedAnimation typo in readme
bj97301 Feb 21, 2018
ff0bbd7
fix removedAnimation typo in readme (#44)
bj97301 Feb 21, 2018
5d60e6d
enable single node movements
bj97301 Feb 21, 2018
a0acaee
Merge branch 'master' of https://github.com/efremidze/Magnetic
bj97301 Feb 21, 2018
80226ea
fix node selections
bj97301 Feb 21, 2018
755c6d1
apply better physics to moving node
bj97301 Feb 22, 2018
3aa3400
decrease move node timer
bj97301 Feb 22, 2018
ef71611
only allow touches if interaction is enabled for a given node
bj97301 Feb 22, 2018
0bd5fd1
Revert "only allow touches if interaction is enabled for a given node"
bj97301 Feb 22, 2018
7df97d6
provide defaults in code comments
bj97301 Feb 23, 2018
fecc9fa
move vars closer to where they are used
bj97301 Feb 23, 2018
5e3df24
call reset touch moved state from canceled event
bj97301 Feb 23, 2018
f33fca8
pull the magical number 30 out of my huge method hat
bj97301 Feb 23, 2018
c638b82
extracted nodeForTouchLocation method from huge method
bj97301 Feb 23, 2018
c712f05
safe refactor and cleanup
bj97301 Feb 23, 2018
b6bac39
add dual magnetic fields
bj97301 Feb 24, 2018
dfc99b1
add code comments
bj97301 Feb 24, 2018
da1dee2
make comments mo betta
bj97301 Feb 27, 2018
1275042
fix compiler error for setting middleMagneticField to depreciated mag…
bj97301 Feb 27, 2018
743067d
give names aka assigning var names to possibly confusing code blocks
bj97301 Feb 28, 2018
061d1a5
allow the label to not be cropped
bj97301 Aug 9, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at efremidzel@hotmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
79 changes: 79 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Contributing to _Magnetic_

The following is a set of guidelines for contributing to _Magnetic_ on GitHub.

> Above all, thank you for your interest in the project and for taking the time to contribute! 👍

## Asking Questions

We don't use GitHub as a support forum.
For any usage questions that are not specific to the project itself,
please ask on [Stack Overflow](https://stackoverflow.com) instead.
By doing so, you'll be more likely to quickly solve your problem,
and you'll allow anyone else with the same question to find the answer.
This also allows maintainers to focus on improving the project for others.

## Reporting Other Issues

A great way to contribute to the project
is to send a detailed issue when you encounter a problem.
We always appreciate a well-written, thorough bug report.

Check that the project issues database
doesn't already include that problem or suggestion before submitting an issue.
If you find a match, add a quick "+1" or "I have this problem too."
Doing this helps prioritize the most common problems and requests.

Before submitting a new GitHub issue, please make sure to

- Check out the [documentation](https://github.com/efremidze/Magnetic).
- Read the usage guide on [the README](https://github.com/efremidze/Magnetic/#usage).
- Search for [existing GitHub issues](https://github.com/efremidze/Magnetic/issues).

If the above doesn't help, please [submit an issue](https://github.com/efremidze/Magnetic/issues) on GitHub.

## I want to contribute to _Magnetic_

### Prerequisites

To develop _Magnetic_, you will need to use an Xcode version compatible with the Swift version specified in the [README](https://github.com/efremidze/Magnetic/#requirements).

### Checking out the repository

- Click the “Fork” button in the upper right corner of repo
- Clone your fork:
- `git clone https://github.com/<YOUR_GITHUB_USERNAME>/Magnetic.git`
- Create a new branch to work on:
- `git checkout -b <YOUR_BRANCH_NAME>`
- A good name for a branch describes the thing you’ll be working on, e.g. `voice-over`, `fix-font-size`, etc.

That’s it! Now you’re ready to work on _Magnetic_. Open the `Magnetic.xcworkspace` workspace to start coding.

### Things to keep in mind

- Please do not change the minimum iOS version
- Always document new public methods and properties

### Testing your local changes

Before opening a pull request, please make sure your changes don't break things.

- The framework and example project should build without warnings
- The example project should run without issues.

### Submitting the PR

When the coding is done and you’ve finished testing your changes, you are ready to submit the PR to the [main repo](https://github.com/efremidze/Magnetic). Some best practices are:

- Use a descriptive title
- Link the issues that are related to your PR in the body

## Code of Conduct

Help us keep _Magnetic_ open and inclusive. Please read and follow our [Code of Conduct](CODE_OF_CONDUCT.md).

## License

This project is licensed under the terms of the MIT license. See the [LICENSE](LICENSE) file.

_These contribution guidelines were adapted from [_fastlane_](https://github.com/fastlane/fastlane) guides._
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!--- Provide a short summary of your issue in the Title above. -->

### New Issue Checklist
<!-- Before you submit your issue, please make sure to check the following boxes by putting an x in the [ ] -->

- [ ] I updated Magnetic to the latest version.
- [ ] I read the [Contribution Guidelines](https://github.com/efremidze/Magnetic/blob/master/.github/CONTRIBUTING.md).
- [ ] I read the [documentation](https://github.com/efremidze/Magnetic).
- [ ] I searched for [existing GitHub issues](https://github.com/efremidze/Magnetic/issues).

### Issue Description
<!--- Describe your issue in detail. -->
<!--- Do not hesitate to attach screenshots if they can be helpful. -->

### Environment

- **iOS Version**: [INSERT iOS VERSION HERE]
- **Device(s)**: [INSERT DEVICE(S) HERE]
15 changes: 15 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!-- Thanks for contributing to _Magnetic_! Before you submit your pull request, please make sure to check the following boxes by putting an x in the [ ] -->

### Checklist
- [ ] I've tested my changes.
- [ ] I've read the [Contribution Guidelines](CONTRIBUTING.md).
- [ ] I've updated the documentation if necessary.

### Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->
<!--- Please describe how you tested your changes. --->
<!-- If you are submitting a link to your app for the README, you can omit this section. -->

### Description
<!--- Describe your changes in detail. -->
1 change: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.0
50 changes: 50 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,55 @@
# Change log

## [Version 2.0.5](https://github.com/efremidze/Magnetic/releases/tag/2.0.5)
Released on 2017-12-13

- Custom node path

## [Version 2.0.4](https://github.com/efremidze/Magnetic/releases/tag/2.0.4)
Released on 2017-12-13

- Image bugs fix

## [Version 2.0.3](https://github.com/efremidze/Magnetic/releases/tag/2.0.3)
Released on 2017-12-10

- Image aspect ratio fix

## [Version 2.0.2](https://github.com/efremidze/Magnetic/releases/tag/2.0.2)
Released on 2017-12-06

- Selection fix

## [Version 2.0.1](https://github.com/efremidze/Magnetic/releases/tag/2.0.1)
Released on 2017-11-21

- Bug fix

## [Version 2.0.0](https://github.com/efremidze/Magnetic/releases/tag/2.0.0)
Released on 2017-09-20

- Updated to Swift 4

## [Version 1.0.8](https://github.com/efremidze/Magnetic/releases/tag/1.0.8)
Released on 2017-09-05

- Fixed radius bug

## [Version 1.0.7](https://github.com/efremidze/Magnetic/releases/tag/1.0.7)
Released on 2017-07-24

- Fixed initializer access

## [Version 1.0.6](https://github.com/efremidze/Magnetic/releases/tag/1.0.6)
Released on 2017-05-14

- Added stroke color

## [Version 1.0.5](https://github.com/efremidze/Magnetic/releases/tag/1.0.5)
Released on 2017-05-11

- Added multiline label

## [Version 1.0.4](https://github.com/efremidze/Magnetic/releases/tag/1.0.4)
Released on 2017-04-06

Expand Down
5 changes: 5 additions & 0 deletions Example/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
Expand Down
2 changes: 1 addition & 1 deletion Example/Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extension UIColor {

extension UIImage {

static let names: [String] = ["argentina", "bolivia", "brazil", "chile", "costa_rica", "cuba", "dominican_republic", "ecuador", "el_salvador", "haiti", "honduras", "mexico", "nicaragua", "panama", "paraguay", "peru", "venezuela"]
static let names: [String] = ["argentina", "bolivia", "brazil", "chile", "costa rica", "cuba", "dominican republic", "ecuador", "el salvador", "haiti", "honduras", "mexico", "nicaragua", "panama", "paraguay", "peru", "venezuela"]

}

Expand Down
23 changes: 19 additions & 4 deletions Example/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class ViewController: UIViewController {
return magneticView.magnetic
}

override func viewDidLoad() {
super.viewDidLoad()
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

for _ in 0..<12 {
add(nil)
Expand All @@ -39,14 +39,18 @@ class ViewController: UIViewController {
let color = UIColor.colors.randomItem()
let node = Node(text: name.capitalized, image: UIImage(named: name), color: color, radius: 40)
magnetic.addChild(node)

// Image Node: image displayed by default
// let node = ImageNode(text: name.capitalized, image: UIImage(named: name), color: color, radius: 40)
// magnetic.addChild(node)
}

@IBAction func reset(_ sender: UIControl?) {
let speed = magnetic.physicsWorld.speed
magnetic.physicsWorld.speed = 0
let sortedNodes = magnetic.children.flatMap { $0 as? Node }.sorted { node, nextNode in
let distance = node.position.distance(from: magnetic.magneticField.position)
let nextDistance = nextNode.position.distance(from: magnetic.magneticField.position)
let distance = node.position.distance(from: magnetic.middleMagneticField.position)
let nextDistance = nextNode.position.distance(from: magnetic.middleMagneticField.position)
return distance < nextDistance && node.isSelected
}
var actions = [SKAction]()
Expand Down Expand Up @@ -89,3 +93,14 @@ extension ViewController: MagneticDelegate {
}

}

// MARK: - ImageNode
class ImageNode: Node {
override var image: UIImage? {
didSet {
sprite.texture = image.map { SKTexture(image: $0) }
}
}
override func selectedAnimation() {}
override func deselectedAnimation() {}
}
102 changes: 0 additions & 102 deletions Example/ViewController2.swift

This file was deleted.

Binary file added Images/logo.sketch
Binary file not shown.
2 changes: 1 addition & 1 deletion Magnetic.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'Magnetic'
s.version = '1.0.4'
s.version = '2.0.5'
s.summary = 'SpriteKit Floating Bubble Picker (inspired by Apple Music)'
s.homepage = 'https://github.com/efremidze/Magnetic'
s.license = { :type => 'MIT', :file => 'LICENSE' }
Expand Down