Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adventam10/amjpnmapview
It can display a simple map of Japan.
https://github.com/adventam10/amjpnmapview
ios japan japanese map swift swift4
Last synced: 3 days ago
JSON representation
It can display a simple map of Japan.
- Host: GitHub
- URL: https://github.com/adventam10/amjpnmapview
- Owner: adventam10
- License: mit
- Created: 2018-01-14T04:14:13.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-10-19T18:14:44.000Z (almost 5 years ago)
- Last Synced: 2024-09-24T20:40:03.535Z (3 days ago)
- Topics: ios, japan, japanese, map, swift, swift4
- Language: Swift
- Homepage: https://qiita.com/am10/items/26de3242ee33b4bd4aae
- Size: 80.1 KB
- Stars: 17
- Watchers: 4
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AMJpnMap
![Pod Platform](https://img.shields.io/cocoapods/p/AMJpnMap.svg?style=flat)
![Pod License](https://img.shields.io/cocoapods/l/AMJpnMap.svg?style=flat)
[![Pod Version](https://img.shields.io/cocoapods/v/AMJpnMap.svg?style=flat)](http://cocoapods.org/pods/AMJpnMap)
[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Swift Package Manager compatible](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager)It can display a simple map of Japan.
## Demo
### AMJpnMapView
| Fig.1 | Fig.2 |
|---|---|
|![map1](https://user-images.githubusercontent.com/34936885/34912790-f0008ab6-f92c-11e7-8c4f-95e0842d1225.gif)|![map2](https://user-images.githubusercontent.com/34936885/34912799-238d8168-f92d-11e7-83ad-0a3004eab8bf.gif)|### AMJpnMapDetailView
## Usage
### AMJpnMapView
```swift
let jpnMapView = AMJpnMapView(frame: view.bounds)
jpnMapView.delegate = self// customize here
view.addSubview(jpnMapView)
```Conform to the protocol in the class implementation.
```swift
func jpnMapView(_ jpnMapView: AMJpnMapView, didSelectAtRegion region: AMRegion) {
// use selected region here
// example 1 (like Fig.1)
jpnMapView.setStrokeColor(color: .black, region: region)
jpnMapView.setScale(scale: 3.0, region: region)
// example 2 (like Fig.2)
jpnMapView.setFillColor(color: .red, region: region)
jpnMapView.setStrokeColor(color: .red, region: region)
}func jpnMapView(_ jpnMapView: AMJpnMapView, didDeselectAtRegion region: AMRegion) {
// use deselected region here
// example 1 (like Fig.1)
jpnMapView.setStrokeColor(color: .green, region: region)
jpnMapView.setScale(scale: 1.0, region: region)
// example 2 (like Fig.2)
jpnMapView.setFillColor(color: .green, region: region)
jpnMapView.setStrokeColor(color: .green, region: region)
}
```#### Customization
`AMJpnMapView` can be customized via the following properties.```swift
@IBInspectable public var strokeColor: UIColor = .green
@IBInspectable public var fillColor: UIColor = .green
@IBInspectable public var strokeColorOkinawaLine: UIColor = .black
```### AMJpnMapDetailView
```swift
let jpnMapView = AMJpnMapDetailView(frame: view.bounds)// customize here
view.addSubview(jpnMapView)
```#### Customization
`AMJpnMapDetailView` can be customized via the following properties.```swift
@IBInspectable public var strokeColor: UIColor = .green
@IBInspectable public var fillColor: UIColor = .green
@IBInspectable public var strokeColorOkinawaLine: UIColor = .black
```Set colors.
```swift
public func setStrokeColor(color: UIColor, prefecture: AMPrefecture)
public func setFillColor(color: UIColor, prefecture: AMPrefecture)
```## Installation
### CocoaPods
Add this to your Podfile.
```ogdl
pod 'AMJpnMap'
```### Carthage
Add this to your Cartfile.
```ogdl
github "adventam10/AMJpnMapView"
```## License
MIT