Skip to content

Commit 1c46c0e

Browse files
committed
Initial commit
0 parents  commit 1c46c0e

File tree

166 files changed

+25977
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+25977
-0
lines changed

.buckconfig

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[cxx]
2+
default_platform = iphonesimulator-x86_64
3+
cflags = -g -fmodules -fobjc-arc -D BUCK -w $(config code_coverage.clang_flags)
4+
cxxflags = -fobjc-arc -std=c++14 -D DEBUG -g $(config code_coverage.clang_flags)
5+
combined_preprocess_and_compile = true
6+
pch_enabled = false
7+
ldflags = -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime $(config code_coverage.ldflags)
8+
9+
[swift]
10+
version = 5
11+
compiler_flags = -DBUCK -whole-module-optimization $(config custom.optimization) $(config custom.config_swift_compiler_flags) $(config code_coverage.swift_flags)
12+
use_filelist = true
13+
14+
[apple]
15+
use_swift_delegate = false
16+
use_header_maps_in_xcode = false
17+
generate_missing_umbrella_headers = true
18+
iphonesimulator_target_sdk_version = 14.0
19+
iphoneos_target_sdk_version = 14.0
20+
provisioning_profile_read_command = security cms -Di
21+
xctool_default_destination_specifier = platform=iOS Simulator,OS=latest
22+
xctool_path = tools/xctool/bin/xctool
23+
24+
[parser]
25+
polyglot_parsing_enabled = true
26+
default_build_file_syntax = SKYLARK
27+
28+
[project]
29+
ide_force_kill = always
30+
project_schemes = true
31+
ide = xcode
32+
allow_symlinks = forbid
33+
ignore = tools, \
34+
.git, \
35+
36+
[build]
37+
threads = 4
38+
39+
[custom]
40+
config = debug
41+
optimization = -Onone
42+
config_swift_compiler_flags = -DDEBUG -enable-testing -g
43+
code_coverage_cflags = -fprofile-instr-generate -fcoverage-mapping
44+
code_coverage_cxxflags = -fprofile-instr-generate -fcoverage-mapping
45+
code_coverage_ldflags = -fprofile-instr-generate
46+
code_coverage_swift_compiler_flags = -profile-generate -profile-coverage-mapping
47+

.gitignore

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
.DS_Store
2+
3+
# Buck
4+
buck-out
5+
.buckd
6+
7+
# Buck binary
8+
tools/buck
9+
10+
# Xcode
11+
**/xcuserdata/
12+
**/*.xcodeproj
13+
**/*.xcworkspace
14+
15+
# Make
16+
*.d
17+
18+
# Build
19+
build/
20+
21+
# DAG chart generated
22+
result.dot
23+
result.png
24+
25+
# Audit rules output
26+
Config/Gen/*.py
27+
28+
# VS Code
29+
.vscode

.swift-format

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": 1,
3+
"lineLength": 100,
4+
"indentation": {
5+
"spaces": 4
6+
},
7+
"maximumBlankLines": 1,
8+
"respectsExistingLineBreaks": true,
9+
"lineBreakBeforeControlFlowKeywords": true,
10+
"lineBreakBeforeEachArgument": true
11+
}

App/AppDelegate.swift

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import AlamofireImage
2+
import SwinjectStoryboard
3+
import UIKit
4+
import WeatherForecastCore
5+
import WeatherForecastNetworking
6+
import WeatherForecastUI
7+
8+
@UIApplicationMain
9+
final class AppDelegate: NSObject, UIApplicationDelegate {
10+
11+
var window: UIWindow?
12+
13+
func application(
14+
_ application: UIApplication,
15+
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
16+
) -> Bool {
17+
return true
18+
}
19+
20+
}
21+
22+
// MARK: - Inject ViewController dependencies
23+
24+
extension SwinjectStoryboard {
25+
@objc class func setup() {
26+
defaultContainer.storyboardInitCompleted(RootViewController.self) { r, c in
27+
c.viewModel = r.resolve(WeatherForecastViewDataProviding.self)
28+
}
29+
30+
defaultContainer.register(HttpClient.self) { _ in
31+
AlamoFireHTTPClient()
32+
}
33+
.inObjectScope(.container)
34+
35+
defaultContainer.register(WeatherForecastClient.self) { c in
36+
OpenWeatherMapClient(httpClient: c.resolve(HttpClient.self)!)
37+
}
38+
39+
defaultContainer.register(WeatherForecastDataProviding.self) { c in
40+
WeatherForecastStore(client: c.resolve(WeatherForecastClient.self)!)
41+
}
42+
43+
defaultContainer.register(WeatherIconProviding.self) { c in
44+
WeatherIconStore(
45+
imageCache: AutoPurgingImageCache(),
46+
client: c.resolve(WeatherForecastClient.self)!
47+
)
48+
}
49+
50+
defaultContainer.register(WeatherForecastViewDataProviding.self) { c in
51+
WeatherForecastViewModel(
52+
forecastDataProvider: c.resolve(WeatherForecastDataProviding.self)!,
53+
weatherIconProvider: c.resolve(WeatherIconProviding.self)!
54+
)
55+
}
56+
}
57+
}

App/BUCK

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
load("//Config:configs.bzl", "app_binary_configs", "info_plist_substitutions", "library_configs")
2+
3+
apple_library(
4+
name = "WeatherForecastLibrary",
5+
configs = library_configs(),
6+
srcs = [
7+
"AppDelegate.swift",
8+
],
9+
deps = [
10+
# First party dependecies
11+
"//Libraries/WeatherForecastUI:WeatherForecastUI",
12+
13+
# Third party dependecies
14+
"//Vendor/SwinjectStoryboard:SwinjectStoryboard",
15+
16+
# Resources
17+
"//App/Resources:Storyboard",
18+
"//App/Resources:Strings",
19+
"//App/Resources:XIBs",
20+
],
21+
visibility = [
22+
"//App:",
23+
"//App/...",
24+
],
25+
)
26+
27+
apple_binary(
28+
name = "WeatherForecastBinary",
29+
configs = app_binary_configs("WeatherForecast"),
30+
deps = [
31+
":WeatherForecastLibrary",
32+
],
33+
srcs = [
34+
"BuckSupportFiles/Dummy.swift",
35+
],
36+
frameworks = [
37+
"$SDKROOT/System/Library/Frameworks/UIKit.framework",
38+
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
39+
],
40+
)
41+
42+
apple_bundle(
43+
name = "WeatherForecast",
44+
extension = "app",
45+
binary = ":WeatherForecastBinary",
46+
info_plist = "Info.plist",
47+
info_plist_substitutions = info_plist_substitutions("WeatherForecast"),
48+
)
49+
50+
apple_package(
51+
name = "WeatherForecastPackage",
52+
bundle = ":WeatherForecast",
53+
)

App/BuckSupportFiles/Dummy.swift

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// This file is meant to be included in an apple_binary that otherwise wouldn't have any code in it.
2+
// Buck apple_binary declarations need at least one source file in them to be properly generated.
3+
// Removing this file may make buck-generated Xcode projects fail to build.

App/Info.plist

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>UIMainStoryboardFile</key>
6+
<string>Main</string>
7+
<key>CFBundleDevelopmentRegion</key>
8+
<string>$(DEVELOPMENT_LANGUAGE)</string>
9+
<key>CFBundleExecutable</key>
10+
<string>$(EXECUTABLE_NAME)</string>
11+
<key>CFBundleIconFiles</key>
12+
<array>
13+
<string>Icon.png</string>
14+
<string>[email protected]</string>
15+
<string>Icon-72.png</string>
16+
<string>[email protected]</string>
17+
<string>Icon-Small-50.png</string>
18+
<string>[email protected]</string>
19+
</array>
20+
<key>CFBundleIdentifier</key>
21+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
22+
<key>CFBundleInfoDictionaryVersion</key>
23+
<string>6.0</string>
24+
<key>CFBundleName</key>
25+
<string>$(PRODUCT_NAME)</string>
26+
<key>CFBundlePackageType</key>
27+
<string>APPL</string>
28+
<key>CFBundleShortVersionString</key>
29+
<string>1.0</string>
30+
<key>CFBundleVersion</key>
31+
<string>1</string>
32+
<key>LSRequiresIPhoneOS</key>
33+
<true/>
34+
<key>UILaunchStoryboardName</key>
35+
<string>LaunchScreen</string>
36+
<key>UIRequiredDeviceCapabilities</key>
37+
<array>
38+
<string>arm64</string>
39+
</array>
40+
<key>UISupportedInterfaceOrientations</key>
41+
<array>
42+
<string>UIInterfaceOrientationPortrait</string>
43+
<string>UIInterfaceOrientationLandscapeLeft</string>
44+
<string>UIInterfaceOrientationLandscapeRight</string>
45+
</array>
46+
<key>UISupportedInterfaceOrientations~ipad</key>
47+
<array>
48+
<string>UIInterfaceOrientationPortrait</string>
49+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
50+
<string>UIInterfaceOrientationLandscapeLeft</string>
51+
<string>UIInterfaceOrientationLandscapeRight</string>
52+
</array>
53+
</dict>
54+
</plist>

App/Resources/BUCK

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apple_resource(
2+
name = "Storyboard",
3+
variants = glob([
4+
"*.lproj/*.storyboard",
5+
]),
6+
visibility = ["//App:"],
7+
)
8+
9+
apple_resource(
10+
name = "Strings",
11+
variants = glob([
12+
"*.lproj/Main.strings",
13+
]),
14+
visibility = ["//App:"],
15+
)
16+
17+
apple_resource(
18+
name = "XIBs",
19+
variants = glob([
20+
"*.lproj/*.xib",
21+
]),
22+
visibility = ["//App:"],
23+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19162" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
3+
<device id="retina6_1" orientation="portrait" appearance="light"/>
4+
<dependencies>
5+
<deployment identifier="iOS"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19144"/>
7+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
8+
<capability name="System colors in document resources" minToolsVersion="11.0"/>
9+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
10+
</dependencies>
11+
<objects>
12+
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ForecastNotFoundView" customModule="WeatherForecastUI"/>
13+
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
14+
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="ForecastNotFoundView" customModule="WeatherForecastUI">
15+
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
16+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
17+
<subviews>
18+
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillEqually" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="tTZ-he-6pT">
19+
<rect key="frame" x="16" y="413" width="382" height="80"/>
20+
<subviews>
21+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Forecast not found" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6J6-eB-K0k">
22+
<rect key="frame" x="91" y="0.0" width="200.5" height="40"/>
23+
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle1"/>
24+
<color key="textColor" systemColor="secondaryLabelColor"/>
25+
<nil key="highlightedColor"/>
26+
</label>
27+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KEO-w7-7p1">
28+
<rect key="frame" x="170.5" y="40" width="41.5" height="40"/>
29+
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle3"/>
30+
<color key="textColor" systemColor="secondaryLabelColor"/>
31+
<nil key="highlightedColor"/>
32+
</label>
33+
</subviews>
34+
<constraints>
35+
<constraint firstAttribute="height" constant="80" id="VH7-bw-3iE"/>
36+
</constraints>
37+
</stackView>
38+
</subviews>
39+
<viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
40+
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
41+
<constraints>
42+
<constraint firstItem="tTZ-he-6pT" firstAttribute="trailing" secondItem="vUN-kp-3ea" secondAttribute="trailing" constant="-16" id="9Ei-rZ-F33"/>
43+
<constraint firstItem="tTZ-he-6pT" firstAttribute="centerY" secondItem="vUN-kp-3ea" secondAttribute="centerY" id="9cA-6l-p2s"/>
44+
<constraint firstItem="tTZ-he-6pT" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="16" id="h7F-c8-XJk"/>
45+
</constraints>
46+
<connections>
47+
<outlet property="messageLabel" destination="KEO-w7-7p1" id="BnJ-sR-6gB"/>
48+
</connections>
49+
<point key="canvasLocation" x="137.68115942028987" y="-12.053571428571429"/>
50+
</view>
51+
</objects>
52+
<resources>
53+
<systemColor name="secondaryLabelColor">
54+
<color red="0.23529411764705882" green="0.23529411764705882" blue="0.2627450980392157" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
55+
</systemColor>
56+
<systemColor name="systemBackgroundColor">
57+
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
58+
</systemColor>
59+
</resources>
60+
</document>

0 commit comments

Comments
 (0)