MIT License

项目介绍

efremidze/Magnetic 是一个托管在 GitHub 上的开源项目,主要使用 Swift 编写,采用 MIT License 许可证,目前获得 1.6k 个 Star、147 次 Fork。

仓库全名
efremidze/Magnetic
开源许可证
MIT License
Star 数
1.6k
Fork 数
147
未关闭 Issue
23

README 摘要

Magnetic Magnetic is a customizable bubble picker like the Apple Music genre selection. Features [x] Adding/Removing Nodes [x] Selection/Deselection/Removed Animations [x] Multiple Selection [x] Images [x] Multiline Label [x] Documentation Requirements iOS 13.0+ (Magnetic 3.3.x), iOS 9.0+ (Magnetic 3.2.1) Swift 5 (Magnetic 3.x), Swift 4 (Magnetic 2.x), Swift 3 (Magnetic 1.x) Usage A Magnetic object is an SKScene. To…

完整内容见 GitHub 原始 README 或本页 。

常见问题

Magnetic 用什么语言开发?

主要使用 Swift 编写,采用 MIT License 许可证,目前有 1.6k 个 Star。

Magnetic 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 Magnetic 的源码?

可以直接克隆仓库:git clone https://github.com/efremidze/Magnetic.git,默认分支为 master;安装与运行步骤见仓库 README。

Magnetic 最近还在维护吗?

仓库最近一次更新为 2025年7月10日,当前有 23 个未关闭 Issue;Star 数为 1.6k,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

SpriteKit Floating Bubble Picker (inspired by Apple Music) 🧲

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
1906
价值分
1003
活跃状态
活跃

语言占比

Objective-C
Ruby
Swift

Release

README

Magnetic

CI CocoaPods Carthage SPM Swift License

Magnetic is a customizable bubble picker like the Apple Music genre selection.

$ pod try Magnetic

Features

  • Adding/Removing Nodes
  • Selection/Deselection/Removed Animations
  • Multiple Selection
  • Images
  • Multiline Label
  • Documentation

Requirements

  • iOS 13.0+ (Magnetic 3.3.x), iOS 9.0+ (Magnetic 3.2.1)
  • Swift 5 (Magnetic 3.x), Swift 4 (Magnetic 2.x), Swift 3 (Magnetic 1.x)

Usage

A Magnetic object is an SKScene.

To display, you present it from an SKView object.

import Magnetic

class ViewController: UIViewController {

    var magnetic: Magnetic?
    
    override func loadView() {
        super.loadView()
        
        let magneticView = MagneticView(frame: self.view.bounds)
        magnetic = magneticView.magnetic
        self.view.addSubview(magneticView)
    }

}
Properties
var magneticDelegate: MagneticDelegate? // magnetic delegate
var allowsMultipleSelection: Bool // controls whether you can select multiple nodes. defaults to true
var selectedChildren: [Node] // returns selected chidren

Nodes

A Node object is a SKShapeNode subclass.

Interaction
// add circular node
let node = Node(text: "Italy", image: UIImage(named: "italy"), color: .red, radius: 30)
magnetic.addChild(node)

// add custom node
let node = Node(text: "France", image: UIImage(named: "france"), color: .blue, path: path, marginScale: 1.1)
magnetic.addChild(node)

// remove node
node.removeFromParent()
Properties
var text: String? // node text
var image: UIImage? // node image
var color: UIColor // node color
Animations
override func selectedAnimation() {
    // override selected animation
}

override func deselectedAnimation() {
    // override deselected animation
}

override func removedAnimation(completion: @escaping () -> Void) {
    // override removed animation
}

Delegation

The MagneticDelegate protocol provides a number of functions for observing the current state of nodes.

func magnetic(_ magnetic: Magnetic, didSelect node: Node) {
    // handle node selection
}

func magnetic(_ magnetic: Magnetic, didDeselect node: Node) {
    // handle node deselection
}

Customization

Subclass the Node for customization.

For example, a node with an image by default:

class ImageNode: Node {
    override var image: UIImage? {
        didSet {
            texture = image.map { SKTexture(image: $0) }
        }
    }
    override func selectedAnimation() {}
    override func deselectedAnimation() {}
}

Installation

CocoaPods

To install with CocoaPods, simply add this in your Podfile:

use_frameworks!
pod "Magnetic"

Carthage

To install with Carthage, simply add this in your Cartfile:

github "efremidze/Magnetic"

Mentions

Communication

  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.

Credits

https://github.com/igalata/Bubble-Picker

License

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

评论

暂无评论