Skip to content

Instantly share code, notes, and snippets.

Avatar

Theophane RUPIN trupin

View GitHub Profile
View weaver_export_example.json
[
{
"dependencies" : [
{
"scope" : "graph",
"name" : "urlSession",
"object_type" : "Reference",
"type" : {
"object_type" : "Type",
"name" : "URLSession"
View weaver_tutorial_25.swift
import UIKit
final class MovieViewController: UIViewController {
private let dependencies: MovieViewControllerDependencyResolver
// weaver: movie <= Movie
// weaver: imageManager = ImageManager
View weaver_tutorial_24.h
@import UIKit;
@protocol WSReviewViewControllerDependencyResolver;
NS_ASSUME_NONNULL_BEGIN
@interface WSReviewViewController: UIViewController
- (instancetype)initWithDependencies:(id<WSReviewViewControllerDependencyResolver>)dependencies NS_SWIFT_NAME(init(injecting:));
View weaver_tutorial_22.swift
@objc final class ReviewTableViewCellViewModel: NSObject {
let content: String
let author: String
@objc(initWithReview:) init(_ review: Review) {
content = review.properties.content
author = review.properties.author
}
}
View weaver_tutorial_17.swift
final class MovieManager {
private let dependencies: MovieManagerDependencyResolver
// weaver: urlSession <- URLSession
init(injecting dependencies: MovieManagerDependencyResolver) {
self.dependencies = dependencies
}
View weaver_tutorial_24.m
#import "WSReviewViewController.h"
#import "Sample-Swift.h"
NS_ASSUME_NONNULL_BEGIN
@interface WSReviewViewController () <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) id<WSReviewViewControllerDependencyResolver> dependencies;
@property (nonatomic, strong) UITableView *tableView;
View weaver_tutorial_23.swift
extension WSReviewViewController: WSReviewViewControllerObjCDependencyInjectable {
// weaver: movieID <= UInt
// weaver: reviewManager = ReviewManager
// weaver: self.isIsolated = true
}
View weaver_tutorial_21.m
#import "WSReviewViewController.h"
#import "Sample-Swift.h"
NS_ASSUME_NONNULL_BEGIN
@interface WSReviewViewController () <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSArray<Review *> *reviews;
View weaver_tutorial_20.swift
@objc final class ReviewManager: NSObject {
private let dependencies: ReviewManagerDependencyResolver
// weaver: urlSession <- URLSession
// weaver: self.isIsolated = true
required init(injecting dependencies: ReviewManagerDependencyResolver) {
self.dependencies = dependencies
View weaver_tutorial_19.swift
@objc final class ReviewPage: NSObject {
let properties: Page<Review.Properties>
init(_ properties: Page<Review.Properties>) {
self.properties = properties
}
@objc var page: UInt {
return properties.page