* Create iOS14 SwiftUI2 sample project

* Initial commit

* Capability for Push Notifications, Remote notifications added.

* missing addTags and configuration

* Resolve headers

* add app icon

* Revert "add app icon"

This reverts commit 66748872f2.
This commit is contained in:
Hyounwoo 2021-01-18 07:35:51 +09:00 коммит произвёл GitHub
Родитель 4fc248e4f0
Коммит 75ca7322c8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
18 изменённых файлов: 972 добавлений и 0 удалений

7
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

Просмотреть файл

@ -0,0 +1,405 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
798DC21A25B2CB0A00075E92 /* SampleNHAppSwiftUI2App.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798DC21925B2CB0A00075E92 /* SampleNHAppSwiftUI2App.swift */; };
798DC21C25B2CB0A00075E92 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798DC21B25B2CB0A00075E92 /* ContentView.swift */; };
798DC21E25B2CB0B00075E92 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 798DC21D25B2CB0B00075E92 /* Assets.xcassets */; };
798DC22125B2CB0B00075E92 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 798DC22025B2CB0B00075E92 /* Preview Assets.xcassets */; };
798DC22E25B2CBB900075E92 /* WindowsAzureMessaging.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 798DC22D25B2CBB900075E92 /* WindowsAzureMessaging.framework */; };
798DC22F25B2CBB900075E92 /* WindowsAzureMessaging.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 798DC22D25B2CBB900075E92 /* WindowsAzureMessaging.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
798DC23325B2CCA100075E92 /* NotificationViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798DC23225B2CCA100075E92 /* NotificationViewModel.swift */; };
798DC23625B2D0EF00075E92 /* TagList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798DC23525B2D0EF00075E92 /* TagList.swift */; };
798DC23825B2D10600075E92 /* NotificationsList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798DC23725B2D10600075E92 /* NotificationsList.swift */; };
798DC23A25B2D22000075E92 /* Row.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798DC23925B2D22000075E92 /* Row.swift */; };
798DC23C25B2D35100075E92 /* SetupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798DC23B25B2D35100075E92 /* SetupView.swift */; };
798DC23E25B2D5CE00075E92 /* DevSettings.plist in Resources */ = {isa = PBXBuildFile; fileRef = 798DC23D25B2D5CE00075E92 /* DevSettings.plist */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
798DC23025B2CBB900075E92 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
798DC22F25B2CBB900075E92 /* WindowsAzureMessaging.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
798DC21625B2CB0A00075E92 /* SampleNHAppSwiftUI2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SampleNHAppSwiftUI2.app; sourceTree = BUILT_PRODUCTS_DIR; };
798DC21925B2CB0A00075E92 /* SampleNHAppSwiftUI2App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleNHAppSwiftUI2App.swift; sourceTree = "<group>"; };
798DC21B25B2CB0A00075E92 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
798DC21D25B2CB0B00075E92 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
798DC22025B2CB0B00075E92 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
798DC22225B2CB0B00075E92 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
798DC22D25B2CBB900075E92 /* WindowsAzureMessaging.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = WindowsAzureMessaging.framework; sourceTree = BUILT_PRODUCTS_DIR; };
798DC23225B2CCA100075E92 /* NotificationViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationViewModel.swift; sourceTree = "<group>"; };
798DC23525B2D0EF00075E92 /* TagList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagList.swift; sourceTree = "<group>"; };
798DC23725B2D10600075E92 /* NotificationsList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationsList.swift; sourceTree = "<group>"; };
798DC23925B2D22000075E92 /* Row.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Row.swift; sourceTree = "<group>"; };
798DC23B25B2D35100075E92 /* SetupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SetupView.swift; sourceTree = "<group>"; };
798DC23D25B2D5CE00075E92 /* DevSettings.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = DevSettings.plist; sourceTree = "<group>"; };
798DC24025B2D6C200075E92 /* SampleNHAppSwiftUI2.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = SampleNHAppSwiftUI2.entitlements; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
798DC21325B2CB0A00075E92 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
798DC22E25B2CBB900075E92 /* WindowsAzureMessaging.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
798DC20D25B2CB0A00075E92 = {
isa = PBXGroup;
children = (
798DC21825B2CB0A00075E92 /* SampleNHAppSwiftUI2 */,
798DC21725B2CB0A00075E92 /* Products */,
798DC22C25B2CBB900075E92 /* Frameworks */,
);
sourceTree = "<group>";
};
798DC21725B2CB0A00075E92 /* Products */ = {
isa = PBXGroup;
children = (
798DC21625B2CB0A00075E92 /* SampleNHAppSwiftUI2.app */,
);
name = Products;
sourceTree = "<group>";
};
798DC21825B2CB0A00075E92 /* SampleNHAppSwiftUI2 */ = {
isa = PBXGroup;
children = (
798DC24025B2D6C200075E92 /* SampleNHAppSwiftUI2.entitlements */,
798DC23425B2D0E000075E92 /* Views */,
798DC23125B2CC9100075E92 /* ViewModels */,
798DC21925B2CB0A00075E92 /* SampleNHAppSwiftUI2App.swift */,
798DC21B25B2CB0A00075E92 /* ContentView.swift */,
798DC21D25B2CB0B00075E92 /* Assets.xcassets */,
798DC22225B2CB0B00075E92 /* Info.plist */,
798DC21F25B2CB0B00075E92 /* Preview Content */,
798DC23D25B2D5CE00075E92 /* DevSettings.plist */,
);
path = SampleNHAppSwiftUI2;
sourceTree = "<group>";
};
798DC21F25B2CB0B00075E92 /* Preview Content */ = {
isa = PBXGroup;
children = (
798DC22025B2CB0B00075E92 /* Preview Assets.xcassets */,
);
path = "Preview Content";
sourceTree = "<group>";
};
798DC22C25B2CBB900075E92 /* Frameworks */ = {
isa = PBXGroup;
children = (
798DC22D25B2CBB900075E92 /* WindowsAzureMessaging.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
798DC23125B2CC9100075E92 /* ViewModels */ = {
isa = PBXGroup;
children = (
798DC23225B2CCA100075E92 /* NotificationViewModel.swift */,
);
path = ViewModels;
sourceTree = "<group>";
};
798DC23425B2D0E000075E92 /* Views */ = {
isa = PBXGroup;
children = (
798DC23525B2D0EF00075E92 /* TagList.swift */,
798DC23725B2D10600075E92 /* NotificationsList.swift */,
798DC23925B2D22000075E92 /* Row.swift */,
798DC23B25B2D35100075E92 /* SetupView.swift */,
);
path = Views;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
798DC21525B2CB0A00075E92 /* SampleNHAppSwiftUI2 */ = {
isa = PBXNativeTarget;
buildConfigurationList = 798DC22525B2CB0B00075E92 /* Build configuration list for PBXNativeTarget "SampleNHAppSwiftUI2" */;
buildPhases = (
798DC21225B2CB0A00075E92 /* Sources */,
798DC21325B2CB0A00075E92 /* Frameworks */,
798DC21425B2CB0A00075E92 /* Resources */,
798DC23025B2CBB900075E92 /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = SampleNHAppSwiftUI2;
productName = SampleNHAppSwiftUI2;
productReference = 798DC21625B2CB0A00075E92 /* SampleNHAppSwiftUI2.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
798DC20E25B2CB0A00075E92 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1230;
LastUpgradeCheck = 1230;
TargetAttributes = {
798DC21525B2CB0A00075E92 = {
CreatedOnToolsVersion = 12.3;
};
};
};
buildConfigurationList = 798DC21125B2CB0A00075E92 /* Build configuration list for PBXProject "SampleNHAppSwiftUI2" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 798DC20D25B2CB0A00075E92;
productRefGroup = 798DC21725B2CB0A00075E92 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
798DC21525B2CB0A00075E92 /* SampleNHAppSwiftUI2 */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
798DC21425B2CB0A00075E92 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
798DC22125B2CB0B00075E92 /* Preview Assets.xcassets in Resources */,
798DC21E25B2CB0B00075E92 /* Assets.xcassets in Resources */,
798DC23E25B2D5CE00075E92 /* DevSettings.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
798DC21225B2CB0A00075E92 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
798DC23825B2D10600075E92 /* NotificationsList.swift in Sources */,
798DC23625B2D0EF00075E92 /* TagList.swift in Sources */,
798DC21C25B2CB0A00075E92 /* ContentView.swift in Sources */,
798DC23C25B2D35100075E92 /* SetupView.swift in Sources */,
798DC21A25B2CB0A00075E92 /* SampleNHAppSwiftUI2App.swift in Sources */,
798DC23A25B2D22000075E92 /* Row.swift in Sources */,
798DC23325B2CCA100075E92 /* NotificationViewModel.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
798DC22325B2CB0B00075E92 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.3;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
798DC22425B2CB0B00075E92 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.3;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
798DC22625B2CB0B00075E92 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = SampleNHAppSwiftUI2/SampleNHAppSwiftUI2.entitlements;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"SampleNHAppSwiftUI2/Preview Content\"";
DEVELOPMENT_TEAM = "";
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = SampleNHAppSwiftUI2/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.microsoft.SampleNHAppSwiftUI2;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
798DC22725B2CB0B00075E92 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = SampleNHAppSwiftUI2/SampleNHAppSwiftUI2.entitlements;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"SampleNHAppSwiftUI2/Preview Content\"";
DEVELOPMENT_TEAM = "";
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = SampleNHAppSwiftUI2/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.microsoft.SampleNHAppSwiftUI2;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
798DC21125B2CB0A00075E92 /* Build configuration list for PBXProject "SampleNHAppSwiftUI2" */ = {
isa = XCConfigurationList;
buildConfigurations = (
798DC22325B2CB0B00075E92 /* Debug */,
798DC22425B2CB0B00075E92 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
798DC22525B2CB0B00075E92 /* Build configuration list for PBXNativeTarget "SampleNHAppSwiftUI2" */ = {
isa = XCConfigurationList;
buildConfigurations = (
798DC22625B2CB0B00075E92 /* Debug */,
798DC22725B2CB0B00075E92 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 798DC20E25B2CB0A00075E92 /* Project object */;
}

Просмотреть файл

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

Просмотреть файл

@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Просмотреть файл

@ -0,0 +1,98 @@
{
"images" : [
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Просмотреть файл

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

Просмотреть файл

@ -0,0 +1,65 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
import SwiftUI
import WindowsAzureMessaging
struct ContentView: View {
@EnvironmentObject var notificationViewModel: NotificationViewModel
@State private var showingAlert = false
@State var notification: MSNotificationHubMessage = MSNotificationHubMessage()
@State private var selection = 0
var body: some View {
TabView(selection: $selection){
SetupView()
.tabItem {
VStack {
Image(systemName: "wrench.fill")
Text("Setup")
}
}
.tag(0)
NotificationsList()
.tabItem {
VStack {
Image(systemName: "tray.fill")
Text("Notifications")
}
}
.tag(1)
}
.onReceive(self.notificationViewModel.messageReceived) { (notification) in
self.didReceivePushNotification(notification: notification, messageTapped: false)
}
.onReceive(self.notificationViewModel.messageTapped) { (notification) in
self.didReceivePushNotification(notification: notification, messageTapped: true)
}
.alert(isPresented: $showingAlert) {
Alert(title: Text(self.notification.title ?? "Important message"), message: Text(self.notification.body ?? "Wear sunscreen"), dismissButton: .default(Text("Got it!")))
}
.environmentObject(notificationViewModel)
}
func didReceivePushNotification(notification: Notification, messageTapped: Bool) {
let message = notification.userInfo!["message"] as! MSNotificationHubMessage
NSLog("Received notification: %@; %@", message.title ?? "<nil>", message.body)
// Assign the latest notification to self.notification.
self.notification = message
// Display Alert if message is tapped from background.
if messageTapped {
self.showingAlert = true
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
.environmentObject(NotificationViewModel())
}
}

Просмотреть файл

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>HUB_NAME</key>
<string></string>
<key>CONNECTION_STRING</key>
<string></string>
</dict>
</plist>

Просмотреть файл

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<true/>
</dict>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
<key>UILaunchScreen</key>
<dict/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

Просмотреть файл

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

Просмотреть файл

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
</dict>
</plist>

Просмотреть файл

@ -0,0 +1,32 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
import SwiftUI
import UserNotifications
import WindowsAzureMessaging
@main
struct SampleNHAppSwiftUI2App: App {
@StateObject private var notificationViewModel = NotificationViewModel()
@Environment(\.scenePhase) private var scenePhase
var body: some Scene {
WindowGroup {
ContentView()
.environmentObject(notificationViewModel)
}
.onChange(of: scenePhase) { (newScenePhase) in
switch newScenePhase {
case .active:
print("scene is now active!")
case .inactive:
print("scene is now inactive!")
case .background:
print("scene is now in the background!")
@unknown default:
print("Apple must have added something new!")
}
}
}
}

Просмотреть файл

@ -0,0 +1,105 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
import UserNotifications
import WindowsAzureMessaging
class NotificationViewModel: NSObject, ObservableObject, MSNotificationHubDelegate, MSInstallationLifecycleDelegate, UNUserNotificationCenterDelegate {
private var notificationPresentationCompletionHandler: Any?
private var notificationResponseCompletionHandler: Any?
@Published var installationId: String = MSNotificationHub.getInstallationId()
@Published var pushChannel: String = MSNotificationHub.getPushChannel()
@Published var items = [MSNotificationHubMessage]()
let messageReceived = NotificationCenter.default
.publisher(for: NSNotification.Name("MessageReceived"))
let messageTapped = NotificationCenter.default
.publisher(for: NSNotification.Name("MessageTapped"))
override init() {
super.init()
if let path = Bundle.main.path(forResource: "DevSettings", ofType: "plist") {
if let configValues = NSDictionary(contentsOfFile: path) {
let connectionString = configValues["CONNECTION_STRING"] as? String
let hubName = configValues["HUB_NAME"] as? String
if (!(connectionString ?? "").isEmpty && !(hubName ?? "").isEmpty)
{
MSNotificationHub.setLifecycleDelegate(self)
UNUserNotificationCenter.current().delegate = self;
MSNotificationHub.setDelegate(self)
MSNotificationHub.start(connectionString: connectionString!, hubName: hubName!)
addTags()
}
}
}
}
func getPlistInfo(resourceName: String, key: String) -> String {
guard let value = Bundle.main.path(forResource: resourceName, ofType: "plist") else {
return ""
}
return value
}
func addTags() {
// Get language and country code for common tag values
let language = Bundle.main.preferredLocalizations.first ?? "<undefined>"
let countryCode = NSLocale.current.regionCode ?? "<undefined>"
// Create tags with type_value format
let languageTag = "language_" + language
let countryCodeTag = "country_" + countryCode
MSNotificationHub.addTags([languageTag, countryCodeTag])
}
@available(iOS 10.0, *)
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
self.notificationPresentationCompletionHandler = completionHandler;
}
@available(iOS 10.0, *)
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
self.notificationResponseCompletionHandler = completionHandler;
}
func notificationHub(_ notificationHub: MSNotificationHub, didSave installation: MSInstallation) {
DispatchQueue.main.async {
self.installationId = installation.installationId
self.pushChannel = installation.pushChannel
}
}
func notificationHub(_ notificationHub: MSNotificationHub!, didReceivePushNotification message: MSNotificationHubMessage!) {
let userInfo = ["message": message!]
// Append receivedPushNotification message to self.items
self.items.append(message)
if (notificationResponseCompletionHandler != nil) {
NSLog("Tapped Notification")
NotificationCenter.default.post(name: NSNotification.Name("MessageTapped"), object: nil, userInfo: userInfo)
} else {
NSLog("Notification received in the foreground")
NotificationCenter.default.post(name: NSNotification.Name("MessageReceived"), object: nil, userInfo: userInfo)
}
// Call notification completion handlers.
if (notificationResponseCompletionHandler != nil) {
(notificationResponseCompletionHandler as! () -> Void)()
notificationResponseCompletionHandler = nil
}
if (notificationPresentationCompletionHandler != nil) {
(notificationPresentationCompletionHandler as! (UNNotificationPresentationOptions) -> Void)([])
notificationPresentationCompletionHandler = nil
}
}
}

Просмотреть файл

@ -0,0 +1,26 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
import SwiftUI
import WindowsAzureMessaging
struct NotificationsList: View {
@EnvironmentObject var notificationViewModel: NotificationViewModel
var body: some View {
List {
ForEach(self.notificationViewModel.items, id: \.self) { notification in
Row(title: notification.title ?? "<nil_title>", message: notification.body ?? "<nil_body>")
}
}
}
}
struct NotificationsList_Previews: PreviewProvider {
static var previews: some View {
NotificationsList()
.environmentObject(NotificationViewModel())
}
}

Просмотреть файл

@ -0,0 +1,28 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
import SwiftUI
struct Row: View {
var title: String = "<nil_title>"
var message: String = ""
var body: some View {
HStack {
Text(title)
.foregroundColor(Color.gray)
Text(message)
.foregroundColor(Color.gray)
Spacer()
}
}
}
struct Row_Previews: PreviewProvider {
static var previews: some View {
Row()
.previewLayout(.fixed(width: 300, height: 70))
}
}

Просмотреть файл

@ -0,0 +1,73 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
import SwiftUI
import WindowsAzureMessaging
struct SetupView: View {
@EnvironmentObject var notificationViewModel: NotificationViewModel
@State var tag: String = "";
@State var tags: [String] = MSNotificationHub.getTags()
@State var userId: String = MSNotificationHub.getUserId()
var body: some View {
VStack(alignment: .leading) {
Text("Device Token:")
.font(.headline)
.padding(.leading)
Text(self.notificationViewModel.pushChannel)
.font(.footnote)
.foregroundColor(Color.gray)
.padding([.leading, .bottom, .trailing])
Text("Installation ID:")
.font(.headline)
.padding(.leading)
Text(self.notificationViewModel.installationId)
.font(.footnote)
.foregroundColor(Color.gray)
.padding([.leading, .bottom, .trailing])
Text("User ID:")
.font(.headline)
.padding(.leading)
TextField("Set User ID", text: $userId, onEditingChanged: {focus in
if(!focus) {
MSNotificationHub.setUserId(self.userId)
}
})
.textFieldStyle(RoundedBorderTextFieldStyle())
.padding([.leading, .bottom, .trailing])
Text("Tags:")
.font(.headline)
.padding(.leading)
TextField("Add new tag", text: $tag, onCommit: {
if(self.tag != "") {
MSNotificationHub.addTag(self.tag)
self.tags.append(self.tag)
self.tag = ""
}
})
.textFieldStyle(RoundedBorderTextFieldStyle())
.padding([.leading, .bottom, .trailing])
TagsList(tags: tags, onDelete: {
$0.forEach({
MSNotificationHub.removeTag(self.tags.remove(at: $0));
})
})
Spacer()
}
}
}
struct SetupView_Previews: PreviewProvider {
static var previews: some View {
SetupView()
.environmentObject(NotificationViewModel())
}
}

Просмотреть файл

@ -0,0 +1,27 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
import SwiftUI
struct TagsList: View {
var tags: [String]
var onDelete: (IndexSet) -> Void
var body: some View {
List {
ForEach(tags, id: \.self) {
Row(title: $0);
}
.onDelete(perform: {
self.onDelete($0)
})
}
}
}
struct TagsList_Previews: PreviewProvider {
static var previews: some View {
TagsList(tags: ["tag1", "tag2"], onDelete: {_ in })
}
}

Просмотреть файл

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:SampleNHAppSwiftUI2/SampleNHAppSwiftUI2.xcodeproj">
</FileRef>
<Group
location = "group:Config"
name = "Config">