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
Write a great README #21
Comments
@smaramba this is another source of inspiration https://github.com/ReSwift/ReSwift |
some inputs, use them if you wish: History, why we have created Katana Why do we release Katana as OSS
Plastic |
@bolismauro @lucaquerella here the first draft of the readme. my suggestion to improve this:
KatanaA modern framework for well-behaved appsKatana is a modern swift framework for writing iOS apps originated from our love for the react/redux philosophy and the lack of an existing native swift implementation.
We feel that Katana helped us a lot since we started using it in production for more than X apps with XXXX active users per day. At BendingSpoons we use a lot of Open Sourced projects ourselves and we wanted to give something back to the community, hoping you will find this useful and possibly contribute. <3 features
InstallationKatana is available through CocoaPods and [Carthage](insert link here), you can also drop Requirements
CocoaPodsCocoaPods is a dependency manager for Cocoa projects. You can install it with the following command: $ sudo gem install cocoapods To integrate Katana into your XCode project using CocoaPods, add it to your
And run: $ pod install CarthageCarthage is a decentralized dependency manager for Cocoa projects. $ brew update
$ brew install carthage To integrate Katana into your XCode project using Carthage, add it to your
And Run: $ carthage update Then drag the built Overviewdefining the logic of your appyour entire app struct ToDoState: State {
var todos: [String]
} the app struct AddTodo: SyncAction {
var payload: String
static func reduce(state: State, action: AddToDo) -> State {
guard var state = state as? ToDoState else { fatalError() }
state.todos.append(action.payload)
return state
}
} the let store = Store<ToDoState>()
store.dispatch(AddTodo("remember the milk")) you can ask the store.addListener() {
tableView.reloadData()
} defining the UIKatana is inspired by React, you declaratively define your UI components called struct ToDoScreen: NodeDescription {
typealias StateType = EmptyState
typealias PropsType = ToDoScreenProps
typealias NativeView = UIView
var props: ToDoScreenProps
} Inside the struct ToDoScreenProps: NodeProps {
var frame: CGRect = .zero
var todos: [String] = []
} When it's time to render the component, the method struct ToDoScreen: NodeDescription {
...
public static func applyPropsToNativeView(props: ToDoScreenProps,
state: EmptyState,
view: UIView, ...) {
view.frame = props.frame
}
}
struct ToDoScreen: NodeDescription {
...
public static func childrenDescriptions(props: ToDoScreenProps,
state: EmptyState, ...) -> [AnyNodeDescription] {
return [
Text(props: TextProps())
.key(.title)
.text("My awesome todos", fontSize: 15)
.borderColor(UIColor("#d54a0c"))
),
Table(props: TableProps()
.key(.todoList)
.delegate(ToDoListDelegate(todos: props.todos))
)
]
}
} attaching the UI to the LogicThe
Everytime a new app state is available the store emits an event that is captured by the Root and dispatched down to the tree of UI components.
layout of the UIKatana have its own language to programmatically define fully responsive layouts that will gracefully scale at every aspect ratio or size, including font sizes and images. struct ToDoScreen: ConnectedNodeDescription {
...
static func layout(views: ViewsContainer<ToDoKeys>, props: ToDoScreenProps, state: EmptyState) {
let rootView = views.nativeView
let title = views[.title]!
let todoList = views[.todoList]!
title.asHeader(rootView, insets: .scalable(30, 0, 0, 0))
title.height = .scalable(60)
todoList.fillHorizontally(rootView)
todoList.top = title.bottom
todoList.bottom = rootView.bottom
}
} You can find the complete example [here](insert link to the complete example) Where to go from hereExplore sample projects[insert here list of sample projects] Check out the documentation[insert here link to the documentation] Communication
LicenseKatana is available under the [MIT license](insert link to LICENSE file here) |
@smaramba can you move that to a pull request? it's hard to review this way. I don't know anything about Swift or Katana, I just wanted to give some generic inputs |
sure, will do right now |
done. |
As discussed we want to touch the following points (more or less in deep) in the README
Let's take a look at other well done README for inspiration.
This is also an interesting resource
The text was updated successfully, but these errors were encountered: