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

No documentation #219

Open
GeorgeLyurko2000ua opened this issue Nov 13, 2017 · 8 comments
Open

No documentation #219

GeorgeLyurko2000ua opened this issue Nov 13, 2017 · 8 comments
Assignees
Labels
epic Large task that can be broken down into a number of issues
Milestone

Comments

@GeorgeLyurko2000ua
Copy link

Please make full documentation because lots of developers and i have no idea how to use most of functions. How for example i can recognise what element do user tap ? How i can modify image via code ? And so on.
Thanks for your help !

@zapletnev
Copy link
Contributor

Hi @GeorgeLyurko2000ua,

Thanks for using Macaw. Yes, we understand that documentation is very important and we are working on it. While let me assist you with questions that you mentioned.

Tap event

You can easily add tap handler on any node. Also, TapEvent has property node:

node.onTap { event in
    print(event.node)
}

Image

You can create image node by next code:

let image = Image(src: "charts.png", w: 30)
group.contents.append(image)

At any time you can change src of the image:

image.src = "new-image.png"

Also, here you can find useful articles about Macaw:

We have a separate repository for different macaw examples: https://github.com/exyte/Macaw-examples. It could be useful for you as well.

Feel free to send any questions about Macaw under this ticket.

@GeorgeLyurko2000ua
Copy link
Author

Thanks you so much for your help !

  • With macaw extension i can parse SVG images and get their code. And i want to modify color, highlight and do other changes to the elements that user taped. So i need to get element ID and change that element via code. Is it possible with your extension and how can i do it.
    You would help me so much and thanks you again !

@zapletnev
Copy link
Contributor

zapletnev commented Nov 14, 2017

I think you have to do something like that:

import UIKit
import Macaw

class SVGExampleView: MacawView {
  required init?(coder aDecoder: NSCoder) {        
    let yourImage = SVGParser.parse(path: "tiger")
    let someElementByID = yourImage.nodeBy(tag: "elementID") as! Shape
    someElementByID.fill = Color.red
    super.init(node: yourImage, coder: aDecoder)
  }
}

@GeorgeLyurko2000ua
Copy link
Author

Thanks you so much again !
And the last question. How can I determine which element has user clicked on ? I am doing an subway map application. There you can select point of departure and point of destination and based on that app would generate a route. For example: user clicked on an oval that has their own id with station name and application would use it to choose point of departure.

@GeorgeLyurko2000ua
Copy link
Author

Спасибо большое !
Я делаю приложение для метро. Как можно распознавать элемент на который нажал пользователь ? Я делаю приложения в котором юзер сможет выбрать начальную и конечную станцию метро, нажимая на неё, и на основе них строить маршрут. Как это можно сделать ?

@zapletnev
Copy link
Contributor

Hi,

In your case, you can add onTap event handler on each element from your SVG.
I made a small example with subway SVG Subway.zip. But please note: latest Macaw release has limited SVG support and I recommend to use master branch.

During testing I found a bug in event.node: #221. I hope we will fix it soon and you will be able to add only one event handler on the root instead of adding handlers on all elements.

Also, if you will make an application that uses Macaw,  please send few screenshots and description of your application at info@exyte.com and we will send you back Macaw stickers!

@JoachimM7
Copy link
Contributor

I would like to help. Would you use it, if I would make some docstrings?

@ystrot
Copy link
Member

ystrot commented Dec 4, 2017

Yes, definitely, we would be glad to use your work on docstrings! We're also planning to publish docstring-based documentation to our wiki to make it more accessible.

@ystrot ystrot self-assigned this Jun 28, 2018
@ystrot ystrot added this to the 0.9.3 milestone Jun 28, 2018
@ystrot ystrot modified the milestones: 0.9.3, 0.9.x Oct 2, 2018
@ystrot ystrot added the epic Large task that can be broken down into a number of issues label Feb 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic Large task that can be broken down into a number of issues
Projects
None yet
Development

No branches or pull requests

4 participants