Skip to content

Commit

Permalink
update:(*) v0.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
niyongsheng committed Apr 7, 2024
1 parent 87e8b78 commit 5c4bd7f
Show file tree
Hide file tree
Showing 69 changed files with 1,482 additions and 434 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ - (void)initWindow {
- (void)initNetwork {
[[NYSKitManager sharedNYSKitManager] setHost:APP_BaseURL];
[[NYSKitManager sharedNYSKitManager] setToken:NUserInfo.token];
[[NYSKitManager sharedNYSKitManager] setDataKey:@"data"];
[[NYSKitManager sharedNYSKitManager] setNormalCode:@"200,0"];
[[NYSKitManager sharedNYSKitManager] setTokenInvalidCode:@"500"];
[[NYSKitManager sharedNYSKitManager] setTokenInvalidMessage:@"验证失败,请先登录"];
Expand Down
10 changes: 5 additions & 5 deletions Examples/Objective-C/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ PODS:
- JCore (>= 2.0.0)
- Masonry (1.1.0)
- MJRefresh (3.7.6)
- NYSKit (0.0.6):
- NYSKit (0.0.7):
- AFNetworking (~> 4.0)
- SVProgressHUD (~> 2.0)
- NYSTK (0.0.8):
- Masonry (>= 1.0.0)
- NYSUIKit (0.0.6):
- NYSUIKit (0.0.7):
- MJRefresh (~> 3.7.6)
- NYSKit (~> 0.0.1)
- NYSKit (~> 0.0.7)
- ReactiveObjC (3.1.1)
- SVProgressHUD (2.3.1):
- SVProgressHUD/Core (= 2.3.1)
Expand Down Expand Up @@ -117,9 +117,9 @@ SPEC CHECKSUMS:
JPush: 76668b765fcfd7c15f86b05ca0e5cdc01945ce23
Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
MJRefresh: 2fe7fb43a5167ceda20bb7e63f130c04fd1814a5
NYSKit: b632a9f33c4c19103f66ba3276b8d519ece9f123
NYSKit: a2873b9901d83616c48d558320b14efcaac98635
NYSTK: 2a3ed92c57614cce6fc20ed21cf82db2d9146217
NYSUIKit: 01e93c7f1e7482f8b2052c61dab3a4db036701f0
NYSUIKit: 66e82bc87d032139b7cb7ce7654ac59356c9e922
ReactiveObjC: 011caa393aa0383245f2dcf9bf02e86b80b36040
SVProgressHUD: 4837c74bdfe2e51e8821c397825996a8d7de6e22
UMAPM: e69eb6542a7c98f31a0d177d31ecfa1a2ceee1c3
Expand Down
16 changes: 8 additions & 8 deletions Examples/Swift/NYSExampleSwift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
C82F2FC32B6E28A900A8F816 /* UIButton+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82F2FC22B6E28A900A8F816 /* UIButton+Extension.swift */; };
C82F2FC82B6E39FC00A8F816 /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82F2FC72B6E39FC00A8F816 /* String+Extension.swift */; };
C83162A42B4CE2750014CFE1 /* TypeNameProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83162A32B4CE2750014CFE1 /* TypeNameProtocol.swift */; };
C83162A72B4CE5160014CFE1 /* UIScrollView+RxSwift.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83162A62B4CE5160014CFE1 /* UIScrollView+RxSwift.swift */; };
C83C18692B33E438002FD985 /* bill.json in Resources */ = {isa = PBXBuildFile; fileRef = C83C18652B33E438002FD985 /* bill.json */; };
C83C186A2B33E438002FD985 /* service.json in Resources */ = {isa = PBXBuildFile; fileRef = C83C18662B33E438002FD985 /* service.json */; };
C83C186B2B33E438002FD985 /* goods.json in Resources */ = {isa = PBXBuildFile; fileRef = C83C18672B33E438002FD985 /* goods.json */; };
Expand Down Expand Up @@ -76,6 +75,7 @@
C86DB21A2B3E8DBC002126F5 /* NYSLoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86DB2162B3E8DBC002126F5 /* NYSLoginViewController.swift */; };
C86DB21F2B3E9E22002126F5 /* WRNavigationBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86DB21D2B3E9E22002126F5 /* WRNavigationBar.swift */; };
C86DB2202B3E9E22002126F5 /* WRCustomNavigationBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86DB21E2B3E9E22002126F5 /* WRCustomNavigationBar.swift */; };
C87021042BC278C60056A806 /* UIView+RxSwift.swift in Sources */ = {isa = PBXBuildFile; fileRef = C87021032BC278C60056A806 /* UIView+RxSwift.swift */; };
C8713F4A2B69E5690090B289 /* PullUpController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8713F492B69E5690090B289 /* PullUpController.swift */; };
C8713F4E2B69EC420090B289 /* NYSPullerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8713F4C2B69EC420090B289 /* NYSPullerViewController.swift */; };
C8713F4F2B69EC420090B289 /* NYSPullerViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C8713F4D2B69EC420090B289 /* NYSPullerViewController.xib */; };
Expand Down Expand Up @@ -169,7 +169,6 @@
C82F2FC22B6E28A900A8F816 /* UIButton+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIButton+Extension.swift"; sourceTree = "<group>"; };
C82F2FC72B6E39FC00A8F816 /* String+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+Extension.swift"; sourceTree = "<group>"; };
C83162A32B4CE2750014CFE1 /* TypeNameProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypeNameProtocol.swift; sourceTree = "<group>"; };
C83162A62B4CE5160014CFE1 /* UIScrollView+RxSwift.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIScrollView+RxSwift.swift"; sourceTree = "<group>"; };
C83C18652B33E438002FD985 /* bill.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = bill.json; sourceTree = "<group>"; };
C83C18662B33E438002FD985 /* service.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = service.json; sourceTree = "<group>"; };
C83C18672B33E438002FD985 /* goods.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = goods.json; sourceTree = "<group>"; };
Expand Down Expand Up @@ -210,6 +209,7 @@
C86DB2162B3E8DBC002126F5 /* NYSLoginViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NYSLoginViewController.swift; sourceTree = "<group>"; };
C86DB21D2B3E9E22002126F5 /* WRNavigationBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WRNavigationBar.swift; sourceTree = "<group>"; };
C86DB21E2B3E9E22002126F5 /* WRCustomNavigationBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WRCustomNavigationBar.swift; sourceTree = "<group>"; };
C87021032BC278C60056A806 /* UIView+RxSwift.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+RxSwift.swift"; sourceTree = "<group>"; };
C8713F492B69E5690090B289 /* PullUpController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PullUpController.swift; sourceTree = "<group>"; };
C8713F4C2B69EC420090B289 /* NYSPullerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NYSPullerViewController.swift; sourceTree = "<group>"; };
C8713F4D2B69EC420090B289 /* NYSPullerViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NYSPullerViewController.xib; sourceTree = "<group>"; };
Expand Down Expand Up @@ -384,7 +384,7 @@
isa = PBXGroup;
children = (
C87CAB742B46773600C84E8E /* Rx+Operators.swift */,
C83162A62B4CE5160014CFE1 /* UIScrollView+RxSwift.swift */,
C87021032BC278C60056A806 /* UIView+RxSwift.swift */,
);
path = RxSwift;
sourceTree = "<group>";
Expand Down Expand Up @@ -989,6 +989,7 @@
C8ED6DE92B551939000F2268 /* NYSServiceCollectionViewCell.swift in Sources */,
C8C5D2432B3E628600117F58 /* NYSBannerCollectionViewCell.swift in Sources */,
C821AAB72B46B2CA003C0968 /* NYSToolBar.m in Sources */,
C87021042BC278C60056A806 /* UIView+RxSwift.swift in Sources */,
C82F2FC12B6E265F00A8F816 /* UIImageView+Extension.swift in Sources */,
C816B6662B4F7B6F00256E58 /* NYSWeaterData.swift in Sources */,
C87CAB7D2B467C8E00C84E8E /* NYSUserInfo.swift in Sources */,
Expand Down Expand Up @@ -1034,7 +1035,6 @@
C8A4BE312B4BBA1800152E14 /* UITableView+Extension.swift in Sources */,
C8474E532B43DD54001DE04A /* NYSRootViewController.swift in Sources */,
C8958BB02B6B5FE400693DAE /* NYSPreviewViewController.swift in Sources */,
C83162A72B4CE5160014CFE1 /* UIScrollView+RxSwift.swift in Sources */,
C89E827B2B731986002BEC52 /* AppDelegate+Extension.swift in Sources */,
C85D7E7C2B60F34300C4BC93 /* NYSImageItemView.swift in Sources */,
C8ED6DDB2B51494D000F2268 /* NYSRootWebViewController.swift in Sources */,
Expand Down Expand Up @@ -1222,7 +1222,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = F9J739W8Y4;
DEVELOPMENT_TEAM = Y24AM9NS72;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "$(SRCROOT)/NYSExampleSwift/Supporting Files/PrefixHeader.pch";
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -1237,7 +1237,7 @@
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = com.nys.example.swift;
PRODUCT_BUNDLE_IDENTIFIER = com.nys.example.swiftDEV;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/NYSExampleSwift/Supporting Files/Bridging-Header.h";
Expand All @@ -1256,7 +1256,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = F9J739W8Y4;
DEVELOPMENT_TEAM = Y24AM9NS72;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "$(SRCROOT)/NYSExampleSwift/Supporting Files/PrefixHeader.pch";
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -1271,7 +1271,7 @@
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = com.nys.example.swift;
PRODUCT_BUNDLE_IDENTIFIER = com.nys.example.swiftDEV;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/NYSExampleSwift/Supporting Files/Bridging-Header.h";
Expand Down

This file was deleted.

149 changes: 149 additions & 0 deletions Examples/Swift/NYSExampleSwift/Extension/RxSwift/UIView+RxSwift.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
//
// UIView+RxSwift.swift
// NYSAppSwift
//
// Created by Nico http://github.com/niyongsheng
// Copyright © 2023 NYS. ALL rights reserved.
//

import Foundation
import RxSwift
import RxCocoa
import MJRefresh

/// 供ViewModel使用
enum MJRefreshAction {
/// 开始刷新
case begainRefresh
/// 停止刷新
case stopRefresh
/// 开始加载更多
case begainLoadmore
/// 停止加载更多
case stopLoadmore
/// 显示无更多数据
case showNomoreData
/// 重置无更多数据
case resetNomoreData
}

// MARK: - UIScrollView Refresh
extension Reactive where Base: UIScrollView {

/// 执行的操作类型
var refreshAction: Binder<MJRefreshAction> {

return Binder(base) { (target, action) in

switch action {
case .begainRefresh:
if let header = target.mj_header {
header.beginRefreshing()
}
if let header = target.refreshControl {
header.beginRefreshing()
}
case .stopRefresh:
if let header = target.mj_header {
header.endRefreshing()
}
if let header = target.refreshControl {
header.endRefreshing()
}
case .begainLoadmore:
if let footer = target.mj_footer {
footer.beginRefreshing()
}
case .stopLoadmore:
if let footer = target.mj_footer {
footer.endRefreshing()
}
case .showNomoreData:
if let footer = target.mj_footer as? MJRefreshAutoNormalFooter {
footer.setTitle("没有更多了", for: MJRefreshState.noMoreData)
footer.endRefreshingWithNoMoreData()
}
case .resetNomoreData:
if let footer = target.mj_footer {
footer.resetNoMoreData()
}
}
}
}
}


// MARK: - NYSBaseViewController Refresh
extension Reactive where Base: NYSBaseViewController {

/// 执行的操作类型
var refreshAction: Binder<MJRefreshAction> {

return Binder(base) { (target, action) in

switch action {
case .begainRefresh:
if let header = target.tableView.mj_header {
header.beginRefreshing()
}
if let header = target.tableView.refreshControl {
header.beginRefreshing()
}
if let header = target.collectionView.mj_header {
header.beginRefreshing()
}
if let header = target.collectionView.refreshControl {
header.beginRefreshing()
}
target.emptyError = NSError(code: .codeUnKnow, description: "加载中...", reason: "", suggestion: "重试", placeholderImg: "icon_loading_nys")
case .stopRefresh:
if let header = target.tableView.mj_header {
header.endRefreshing()
}
if let header = target.tableView.refreshControl {
header.endRefreshing()
}
if let header = target.collectionView.mj_header {
header.endRefreshing()
}
if let header = target.collectionView.refreshControl {
header.endRefreshing()
}
target.emptyError = NSError(code: .codeUnKnow, description: "没有更多了", reason: "", suggestion: "重试", placeholderImg: "icon_error_nys")
case .begainLoadmore:
if let footer = target.tableView.mj_footer {
footer.beginRefreshing()
}
if let footer = target.collectionView.mj_footer {
footer.beginRefreshing()
}
target.emptyError = NSError(code: .codeUnKnow, description: "加载中...", reason: "", suggestion: "重试", placeholderImg: "icon_loading_nys")
case .stopLoadmore:
if let footer = target.tableView.mj_footer {
footer.endRefreshing()
}
if let footer = target.collectionView.mj_footer {
footer.endRefreshing()
}
target.emptyError = NSError(code: .codeUnKnow, description: "没有更多了", reason: "", suggestion: "重试", placeholderImg: "icon_error_nys")
case .showNomoreData:
if let footer = target.tableView.mj_footer as? MJRefreshAutoNormalFooter {
footer.setTitle("没有更多了", for: MJRefreshState.noMoreData)
footer.endRefreshingWithNoMoreData()
}
if let footer = target.collectionView.mj_footer as? MJRefreshAutoNormalFooter {
footer.setTitle("没有更多了", for: MJRefreshState.noMoreData)
footer.endRefreshingWithNoMoreData()
}
target.emptyError = NSError(code: .codeUnKnow, description: "没有更多了", reason: "", suggestion: "重试", placeholderImg: "icon_error_nys")
case .resetNomoreData:
if let footer = target.tableView.mj_footer {
footer.resetNoMoreData()
}
if let footer = target.collectionView.mj_footer {
footer.resetNoMoreData()
}
}
}
}
}
16 changes: 10 additions & 6 deletions Examples/Swift/NYSExampleSwift/Manager/M/AppManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,13 @@ extension AppManager {

/// 登入
func loginHandler(loginType: AppLoginType, params: [String: Any], completion: AppManagerCompletion) {
NYSNetRequest.mockRequest(withParameters: "login_data.json",
isCheck: true,
NYSNetRequest.mockRequest(with: .GET,
url: "login_data.json",
parameters: nil,
remark: "登录",
success: { [weak self] response in
if let token = response?["token"] as? String {
let respDict = response as? [String: Any]
if let token = respDict?["token"] as? String {
self?.token = token
completion?(true, nil, nil)
} else {
Expand Down Expand Up @@ -124,13 +126,15 @@ extension AppManager {
return
}

NYSNetRequest.mockRequest(withParameters: "userinfo_data.json",
isCheck: true,
NYSNetRequest.mockRequest(with: .GET,
url: "userinfo_data.json",
parameters: nil,
remark: "重载用户信息",
success: { [weak self] response in

do {
let userinfo = try response?.decoded() as NYSUserInfo?
let respDict = response as? [String: Any]
let userinfo = try respDict?.decoded() as NYSUserInfo?
self?.userInfo = userinfo ?? NYSUserInfo()

let tagSet: Set<String> = Set(userinfo!.tagArr)
Expand Down
Loading

0 comments on commit 5c4bd7f

Please sign in to comment.