re-enable imessage
|
Before Width: | Height: | Size: 346 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 8.0 KiB |
@@ -1,59 +1,70 @@
|
|||||||
{
|
{
|
||||||
"images" : [
|
"images" : [
|
||||||
{
|
{
|
||||||
"filename" : "120_90.png",
|
"idiom" : "iphone",
|
||||||
|
"scale" : "2x",
|
||||||
|
"size" : "29x29"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "iphone",
|
||||||
|
"scale" : "3x",
|
||||||
|
"size" : "29x29"
|
||||||
|
},
|
||||||
|
{
|
||||||
"idiom" : "iphone",
|
"idiom" : "iphone",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
"size" : "60x45"
|
"size" : "60x45"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "180_135.png",
|
|
||||||
"idiom" : "iphone",
|
"idiom" : "iphone",
|
||||||
"scale" : "3x",
|
"scale" : "3x",
|
||||||
"size" : "60x45"
|
"size" : "60x45"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "134_100.png",
|
"idiom" : "ipad",
|
||||||
|
"scale" : "2x",
|
||||||
|
"size" : "29x29"
|
||||||
|
},
|
||||||
|
{
|
||||||
"idiom" : "ipad",
|
"idiom" : "ipad",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
"size" : "67x50"
|
"size" : "67x50"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "148_110.png",
|
|
||||||
"idiom" : "ipad",
|
"idiom" : "ipad",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
"size" : "74x55"
|
"size" : "74x55"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "54_40.png",
|
"idiom" : "ios-marketing",
|
||||||
|
"scale" : "1x",
|
||||||
|
"size" : "1024x1024"
|
||||||
|
},
|
||||||
|
{
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"platform" : "ios",
|
"platform" : "ios",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
"size" : "27x20"
|
"size" : "27x20"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "81_60.png",
|
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"platform" : "ios",
|
"platform" : "ios",
|
||||||
"scale" : "3x",
|
"scale" : "3x",
|
||||||
"size" : "27x20"
|
"size" : "27x20"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "64_48.png",
|
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"platform" : "ios",
|
"platform" : "ios",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
"size" : "32x24"
|
"size" : "32x24"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "96_72.png",
|
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"platform" : "ios",
|
"platform" : "ios",
|
||||||
"scale" : "3x",
|
"scale" : "3x",
|
||||||
"size" : "32x24"
|
"size" : "32x24"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "1024_768.png",
|
|
||||||
"idiom" : "ios-marketing",
|
"idiom" : "ios-marketing",
|
||||||
"platform" : "ios",
|
"platform" : "ios",
|
||||||
"scale" : "1x",
|
"scale" : "1x",
|
||||||
|
|||||||
@@ -17,24 +17,24 @@ extension String {
|
|||||||
|
|
||||||
// This uses the Words Structure, it doesn't need History.
|
// This uses the Words Structure, it doesn't need History.
|
||||||
class MessagesViewController: MSMessagesAppViewController {
|
class MessagesViewController: MSMessagesAppViewController {
|
||||||
|
|
||||||
// MARK: UI VARS
|
// MARK: UI VARS
|
||||||
@IBOutlet weak var sfwLabel: UIBarButtonItem!
|
@IBOutlet weak var sfwLabel: UIBarButtonItem!
|
||||||
@IBOutlet weak var phraseLabel: UILabel!
|
@IBOutlet weak var phraseLabel: UILabel!
|
||||||
|
|
||||||
|
|
||||||
// MARK: Local Vars
|
// MARK: Local Vars
|
||||||
var sfw = true
|
var sfw = true
|
||||||
var sentence = Sentence()
|
var sentence = Sentence()
|
||||||
|
|
||||||
|
|
||||||
// MARK: functions
|
// MARK: functions
|
||||||
// first load, Let's explain what the need to do.
|
// first load, Let's explain what the need to do.
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
phraseLabel.text = "Swipe down for new words, up to send."
|
phraseLabel.text = "Swipe down for new words, up to send."
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggle sfw
|
// Toggle sfw
|
||||||
@IBAction func sfwToggle(_ sender: Any) {
|
@IBAction func sfwToggle(_ sender: Any) {
|
||||||
if !sfw {
|
if !sfw {
|
||||||
@@ -47,22 +47,22 @@ class MessagesViewController: MSMessagesAppViewController {
|
|||||||
updatePhraseLabel()
|
updatePhraseLabel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let's get a new phrase
|
// Let's get a new phrase
|
||||||
@IBAction func newPhrase(_ sender: Any) {
|
@IBAction func newPhrase(_ sender: Any) {
|
||||||
sentence = Sentence().new(current: sentence)
|
sentence = Sentence().new(current: sentence)
|
||||||
updatePhraseLabel()
|
updatePhraseLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send a phrase to messages
|
// Send a phrase to messages
|
||||||
@IBAction func sendPhrase(_ sender: Any) {
|
@IBAction func sendPhrase(_ sender: Any) {
|
||||||
let conversation = self.activeConversation
|
let conversation = self.activeConversation
|
||||||
conversation?.insertText(phraseLabel.text!) { error in }
|
conversation?.insertText(phraseLabel.text!) { error in }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the label
|
// Update the label
|
||||||
func updatePhraseLabel() {
|
func updatePhraseLabel() {
|
||||||
phraseLabel.text =
|
phraseLabel.text =
|
||||||
sentence.word(.first, safe: sfw).uppercaseFirst + " " +
|
sentence.word(.first, safe: sfw).uppercaseFirst + " " +
|
||||||
sentence.word(.second, safe: sfw).uppercaseFirst + " " +
|
sentence.word(.second, safe: sfw).uppercaseFirst + " " +
|
||||||
sentence.word(.noun, safe: sfw).uppercaseFirst
|
sentence.word(.noun, safe: sfw).uppercaseFirst
|
||||||
|
|||||||
@@ -3,10 +3,15 @@
|
|||||||
archiveVersion = 1;
|
archiveVersion = 1;
|
||||||
classes = {
|
classes = {
|
||||||
};
|
};
|
||||||
objectVersion = 63;
|
objectVersion = 70;
|
||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
|
761EDD473003EB67006FC7FB /* Intents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761EDD463003EB67006FC7FB /* Intents.swift */; };
|
||||||
|
761EDD4D3003F175006FC7FB /* Messages.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76C445E02BDD4DE30033B339 /* Messages.framework */; };
|
||||||
|
761EDD593003F176006FC7FB /* Interject! iMessage.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 761EDD4C3003F175006FC7FB /* Interject! iMessage.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||||
|
761EDD6E3003F269006FC7FB /* words.json in Resources */ = {isa = PBXBuildFile; fileRef = 765F5A4B30029EC7004C2F29 /* words.json */; };
|
||||||
|
761EDD703003F5FF006FC7FB /* Words.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98D0A2DE274721620084F7F9 /* Words.swift */; };
|
||||||
762C51A22BC33AE5000689D9 /* Tips.swift in Sources */ = {isa = PBXBuildFile; fileRef = 762C51A12BC33AE5000689D9 /* Tips.swift */; };
|
762C51A22BC33AE5000689D9 /* Tips.swift in Sources */ = {isa = PBXBuildFile; fileRef = 762C51A12BC33AE5000689D9 /* Tips.swift */; };
|
||||||
762C51A42BCAD9BC000689D9 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 762C51A32BCAD9BC000689D9 /* StoreKit.framework */; };
|
762C51A42BCAD9BC000689D9 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 762C51A32BCAD9BC000689D9 /* StoreKit.framework */; };
|
||||||
762C51A62BCADA1C000689D9 /* Products.storekit in Resources */ = {isa = PBXBuildFile; fileRef = 762C51A52BCADA1C000689D9 /* Products.storekit */; };
|
762C51A62BCADA1C000689D9 /* Products.storekit in Resources */ = {isa = PBXBuildFile; fileRef = 762C51A52BCADA1C000689D9 /* Products.storekit */; };
|
||||||
@@ -34,6 +39,13 @@
|
|||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
|
761EDD573003F176006FC7FB /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 98D0A29D27471FF80084F7F9 /* Project object */;
|
||||||
|
proxyType = 1;
|
||||||
|
remoteGlobalIDString = 761EDD4B3003F175006FC7FB;
|
||||||
|
remoteInfo = "Interject! iMessage";
|
||||||
|
};
|
||||||
98D0A2B627471FF90084F7F9 /* PBXContainerItemProxy */ = {
|
98D0A2B627471FF90084F7F9 /* PBXContainerItemProxy */ = {
|
||||||
isa = PBXContainerItemProxy;
|
isa = PBXContainerItemProxy;
|
||||||
containerPortal = 98D0A29D27471FF80084F7F9 /* Project object */;
|
containerPortal = 98D0A29D27471FF80084F7F9 /* Project object */;
|
||||||
@@ -57,6 +69,7 @@
|
|||||||
dstPath = "";
|
dstPath = "";
|
||||||
dstSubfolderSpec = 13;
|
dstSubfolderSpec = 13;
|
||||||
files = (
|
files = (
|
||||||
|
761EDD593003F176006FC7FB /* Interject! iMessage.appex in Embed Foundation Extensions */,
|
||||||
);
|
);
|
||||||
name = "Embed Foundation Extensions";
|
name = "Embed Foundation Extensions";
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@@ -64,11 +77,8 @@
|
|||||||
/* End PBXCopyFilesBuildPhase section */
|
/* End PBXCopyFilesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
760B5A742BDD538100ADE31A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
761EDD463003EB67006FC7FB /* Intents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Intents.swift; sourceTree = "<group>"; };
|
||||||
761F89D12BDF0AC1003D2DD2 /* MainInterface.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = MainInterface.storyboard; sourceTree = "<group>"; };
|
761EDD4C3003F175006FC7FB /* Interject! iMessage.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Interject! iMessage.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
761F89D32BDF0ACC003D2DD2 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
|
|
||||||
761F89D52BDF0AE3003D2DD2 /* MessagesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessagesViewController.swift; sourceTree = "<group>"; };
|
|
||||||
761F89D72BDF0AF3003D2DD2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
|
||||||
762C51A12BC33AE5000689D9 /* Tips.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tips.swift; sourceTree = "<group>"; };
|
762C51A12BC33AE5000689D9 /* Tips.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tips.swift; sourceTree = "<group>"; };
|
||||||
762C51A32BCAD9BC000689D9 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; };
|
762C51A32BCAD9BC000689D9 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; };
|
||||||
762C51A52BCADA1C000689D9 /* Products.storekit */ = {isa = PBXFileReference; lastKnownFileType = text; path = Products.storekit; sourceTree = "<group>"; };
|
762C51A52BCADA1C000689D9 /* Products.storekit */ = {isa = PBXFileReference; lastKnownFileType = text; path = Products.storekit; sourceTree = "<group>"; };
|
||||||
@@ -99,7 +109,29 @@
|
|||||||
98EA0F3628636B6400B4E136 /* ToolbarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToolbarView.swift; sourceTree = "<group>"; };
|
98EA0F3628636B6400B4E136 /* ToolbarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToolbarView.swift; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
|
/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
|
||||||
|
761EDD6F3003F317006FC7FB /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = {
|
||||||
|
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
|
||||||
|
membershipExceptions = (
|
||||||
|
Info.plist,
|
||||||
|
);
|
||||||
|
target = 761EDD4B3003F175006FC7FB /* Interject! iMessage */;
|
||||||
|
};
|
||||||
|
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
|
||||||
|
|
||||||
|
/* Begin PBXFileSystemSynchronizedRootGroup section */
|
||||||
|
761EDD4E3003F175006FC7FB /* Interject! iMessage */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (761EDD6F3003F317006FC7FB /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = "Interject! iMessage"; sourceTree = "<group>"; };
|
||||||
|
/* End PBXFileSystemSynchronizedRootGroup section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
761EDD493003F175006FC7FB /* Frameworks */ = {
|
||||||
|
isa = PBXFrameworksBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
761EDD4D3003F175006FC7FB /* Messages.framework in Frameworks */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
98D0A2A227471FF80084F7F9 /* Frameworks */ = {
|
98D0A2A227471FF80084F7F9 /* Frameworks */ = {
|
||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
@@ -125,18 +157,6 @@
|
|||||||
/* End PBXFrameworksBuildPhase section */
|
/* End PBXFrameworksBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXGroup section */
|
/* Begin PBXGroup section */
|
||||||
760B5A6C2BDD537F00ADE31A /* Interject! iMessage */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
761F89D72BDF0AF3003D2DD2 /* Assets.xcassets */,
|
|
||||||
761F89D52BDF0AE3003D2DD2 /* MessagesViewController.swift */,
|
|
||||||
761F89D12BDF0AC1003D2DD2 /* MainInterface.storyboard */,
|
|
||||||
761F89D32BDF0ACC003D2DD2 /* LaunchScreen.storyboard */,
|
|
||||||
760B5A742BDD538100ADE31A /* Info.plist */,
|
|
||||||
);
|
|
||||||
path = "Interject! iMessage";
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
9814700B286161EC0097E0A7 /* Utils */ = {
|
9814700B286161EC0097E0A7 /* Utils */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@@ -160,7 +180,7 @@
|
|||||||
98D0A2A727471FF80084F7F9 /* Interject! */,
|
98D0A2A727471FF80084F7F9 /* Interject! */,
|
||||||
98D0A2B827471FF90084F7F9 /* Interject!Tests */,
|
98D0A2B827471FF90084F7F9 /* Interject!Tests */,
|
||||||
98D0A2C227471FF90084F7F9 /* Interject!UITests */,
|
98D0A2C227471FF90084F7F9 /* Interject!UITests */,
|
||||||
760B5A6C2BDD537F00ADE31A /* Interject! iMessage */,
|
761EDD4E3003F175006FC7FB /* Interject! iMessage */,
|
||||||
9879879A2865299F00E82AF6 /* Frameworks */,
|
9879879A2865299F00E82AF6 /* Frameworks */,
|
||||||
98D0A2A627471FF80084F7F9 /* Products */,
|
98D0A2A627471FF80084F7F9 /* Products */,
|
||||||
);
|
);
|
||||||
@@ -172,6 +192,7 @@
|
|||||||
98D0A2A527471FF80084F7F9 /* Interject!.app */,
|
98D0A2A527471FF80084F7F9 /* Interject!.app */,
|
||||||
98D0A2B527471FF90084F7F9 /* Interject!Tests.xctest */,
|
98D0A2B527471FF90084F7F9 /* Interject!Tests.xctest */,
|
||||||
98D0A2BF27471FF90084F7F9 /* Interject!UITests.xctest */,
|
98D0A2BF27471FF90084F7F9 /* Interject!UITests.xctest */,
|
||||||
|
761EDD4C3003F175006FC7FB /* Interject! iMessage.appex */,
|
||||||
);
|
);
|
||||||
name = Products;
|
name = Products;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -188,6 +209,7 @@
|
|||||||
762C51A92BCB4305000689D9 /* Products.plist */,
|
762C51A92BCB4305000689D9 /* Products.plist */,
|
||||||
76CBBDC12BD46EA10019C344 /* PrivacyInfo.xcprivacy */,
|
76CBBDC12BD46EA10019C344 /* PrivacyInfo.xcprivacy */,
|
||||||
765F5A4B30029EC7004C2F29 /* words.json */,
|
765F5A4B30029EC7004C2F29 /* words.json */,
|
||||||
|
761EDD463003EB67006FC7FB /* Intents.swift */,
|
||||||
);
|
);
|
||||||
path = "Interject!";
|
path = "Interject!";
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -247,6 +269,28 @@
|
|||||||
/* End PBXGroup section */
|
/* End PBXGroup section */
|
||||||
|
|
||||||
/* Begin PBXNativeTarget section */
|
/* Begin PBXNativeTarget section */
|
||||||
|
761EDD4B3003F175006FC7FB /* Interject! iMessage */ = {
|
||||||
|
isa = PBXNativeTarget;
|
||||||
|
buildConfigurationList = 761EDD5B3003F176006FC7FB /* Build configuration list for PBXNativeTarget "Interject! iMessage" */;
|
||||||
|
buildPhases = (
|
||||||
|
761EDD483003F175006FC7FB /* Sources */,
|
||||||
|
761EDD493003F175006FC7FB /* Frameworks */,
|
||||||
|
761EDD4A3003F175006FC7FB /* Resources */,
|
||||||
|
);
|
||||||
|
buildRules = (
|
||||||
|
);
|
||||||
|
dependencies = (
|
||||||
|
);
|
||||||
|
fileSystemSynchronizedGroups = (
|
||||||
|
761EDD4E3003F175006FC7FB /* Interject! iMessage */,
|
||||||
|
);
|
||||||
|
name = "Interject! iMessage";
|
||||||
|
packageProductDependencies = (
|
||||||
|
);
|
||||||
|
productName = "Interject! iMessage";
|
||||||
|
productReference = 761EDD4C3003F175006FC7FB /* Interject! iMessage.appex */;
|
||||||
|
productType = "com.apple.product-type.app-extension.messages";
|
||||||
|
};
|
||||||
98D0A2A427471FF80084F7F9 /* Interject! */ = {
|
98D0A2A427471FF80084F7F9 /* Interject! */ = {
|
||||||
isa = PBXNativeTarget;
|
isa = PBXNativeTarget;
|
||||||
buildConfigurationList = 98D0A2C927471FF90084F7F9 /* Build configuration list for PBXNativeTarget "Interject!" */;
|
buildConfigurationList = 98D0A2C927471FF90084F7F9 /* Build configuration list for PBXNativeTarget "Interject!" */;
|
||||||
@@ -259,6 +303,7 @@
|
|||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
dependencies = (
|
dependencies = (
|
||||||
|
761EDD583003F176006FC7FB /* PBXTargetDependency */,
|
||||||
);
|
);
|
||||||
name = "Interject!";
|
name = "Interject!";
|
||||||
productName = "Interject!";
|
productName = "Interject!";
|
||||||
@@ -308,9 +353,13 @@
|
|||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
attributes = {
|
attributes = {
|
||||||
BuildIndependentTargetsInParallel = 1;
|
BuildIndependentTargetsInParallel = 1;
|
||||||
LastSwiftUpdateCheck = 1530;
|
LastSwiftUpdateCheck = 2650;
|
||||||
LastUpgradeCheck = 2650;
|
LastUpgradeCheck = 2650;
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
|
761EDD4B3003F175006FC7FB = {
|
||||||
|
CreatedOnToolsVersion = 26.5;
|
||||||
|
LastSwiftMigration = 2650;
|
||||||
|
};
|
||||||
98D0A2A427471FF80084F7F9 = {
|
98D0A2A427471FF80084F7F9 = {
|
||||||
CreatedOnToolsVersion = 13.1;
|
CreatedOnToolsVersion = 13.1;
|
||||||
};
|
};
|
||||||
@@ -340,11 +389,20 @@
|
|||||||
98D0A2A427471FF80084F7F9 /* Interject! */,
|
98D0A2A427471FF80084F7F9 /* Interject! */,
|
||||||
98D0A2B427471FF90084F7F9 /* Interject!Tests */,
|
98D0A2B427471FF90084F7F9 /* Interject!Tests */,
|
||||||
98D0A2BE27471FF90084F7F9 /* Interject!UITests */,
|
98D0A2BE27471FF90084F7F9 /* Interject!UITests */,
|
||||||
|
761EDD4B3003F175006FC7FB /* Interject! iMessage */,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
/* End PBXProject section */
|
/* End PBXProject section */
|
||||||
|
|
||||||
/* Begin PBXResourcesBuildPhase section */
|
/* Begin PBXResourcesBuildPhase section */
|
||||||
|
761EDD4A3003F175006FC7FB /* Resources */ = {
|
||||||
|
isa = PBXResourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
761EDD6E3003F269006FC7FB /* words.json in Resources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
98D0A2A327471FF80084F7F9 /* Resources */ = {
|
98D0A2A327471FF80084F7F9 /* Resources */ = {
|
||||||
isa = PBXResourcesBuildPhase;
|
isa = PBXResourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
@@ -375,6 +433,14 @@
|
|||||||
/* End PBXResourcesBuildPhase section */
|
/* End PBXResourcesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXSourcesBuildPhase section */
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
|
761EDD483003F175006FC7FB /* Sources */ = {
|
||||||
|
isa = PBXSourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
761EDD703003F5FF006FC7FB /* Words.swift in Sources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
98D0A2A127471FF80084F7F9 /* Sources */ = {
|
98D0A2A127471FF80084F7F9 /* Sources */ = {
|
||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
@@ -391,6 +457,7 @@
|
|||||||
981334CE2754530100E9E53A /* WordView.swift in Sources */,
|
981334CE2754530100E9E53A /* WordView.swift in Sources */,
|
||||||
98EA0F3728636B6400B4E136 /* ToolbarView.swift in Sources */,
|
98EA0F3728636B6400B4E136 /* ToolbarView.swift in Sources */,
|
||||||
98D0A2E1274721620084F7F9 /* Words.swift in Sources */,
|
98D0A2E1274721620084F7F9 /* Words.swift in Sources */,
|
||||||
|
761EDD473003EB67006FC7FB /* Intents.swift in Sources */,
|
||||||
98D0A2E2274721620084F7F9 /* Settings.swift in Sources */,
|
98D0A2E2274721620084F7F9 /* Settings.swift in Sources */,
|
||||||
98D0A2D8274720360084F7F9 /* SentenceView.swift in Sources */,
|
98D0A2D8274720360084F7F9 /* SentenceView.swift in Sources */,
|
||||||
);
|
);
|
||||||
@@ -416,6 +483,11 @@
|
|||||||
/* End PBXSourcesBuildPhase section */
|
/* End PBXSourcesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXTargetDependency section */
|
/* Begin PBXTargetDependency section */
|
||||||
|
761EDD583003F176006FC7FB /* PBXTargetDependency */ = {
|
||||||
|
isa = PBXTargetDependency;
|
||||||
|
target = 761EDD4B3003F175006FC7FB /* Interject! iMessage */;
|
||||||
|
targetProxy = 761EDD573003F176006FC7FB /* PBXContainerItemProxy */;
|
||||||
|
};
|
||||||
98D0A2B727471FF90084F7F9 /* PBXTargetDependency */ = {
|
98D0A2B727471FF90084F7F9 /* PBXTargetDependency */ = {
|
||||||
isa = PBXTargetDependency;
|
isa = PBXTargetDependency;
|
||||||
target = 98D0A2A427471FF80084F7F9 /* Interject! */;
|
target = 98D0A2A427471FF80084F7F9 /* Interject! */;
|
||||||
@@ -429,6 +501,74 @@
|
|||||||
/* End PBXTargetDependency section */
|
/* End PBXTargetDependency section */
|
||||||
|
|
||||||
/* Begin XCBuildConfiguration section */
|
/* Begin XCBuildConfiguration section */
|
||||||
|
761EDD5C3003F176006FC7FB /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ASSETCATALOG_COMPILER_APPICON_NAME = "iMessage App Icon";
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||||
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
|
INFOPLIST_FILE = "Interject! iMessage/Info.plist";
|
||||||
|
INFOPLIST_KEY_CFBundleDisplayName = "Interject! iMessage";
|
||||||
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 26.5;
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
"@executable_path/../../Frameworks",
|
||||||
|
);
|
||||||
|
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||||
|
MARKETING_VERSION = 3.04;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = "us.hinnen.Interject-.Interject--iMessage";
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
STRING_CATALOG_GENERATE_SYMBOLS = YES;
|
||||||
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
|
||||||
|
SWIFT_APPROACHABLE_CONCURRENCY = YES;
|
||||||
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
|
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
761EDD5D3003F176006FC7FB /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ASSETCATALOG_COMPILER_APPICON_NAME = "iMessage App Icon";
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||||
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
|
INFOPLIST_FILE = "Interject! iMessage/Info.plist";
|
||||||
|
INFOPLIST_KEY_CFBundleDisplayName = "Interject! iMessage";
|
||||||
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 26.5;
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
"@executable_path/../../Frameworks",
|
||||||
|
);
|
||||||
|
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||||
|
MARKETING_VERSION = 3.04;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = "us.hinnen.Interject-.Interject--iMessage";
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
STRING_CATALOG_GENERATE_SYMBOLS = YES;
|
||||||
|
SWIFT_APPROACHABLE_CONCURRENCY = YES;
|
||||||
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
|
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
98D0A2C727471FF90084F7F9 /* Debug */ = {
|
98D0A2C727471FF90084F7F9 /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
@@ -708,6 +848,15 @@
|
|||||||
/* End XCBuildConfiguration section */
|
/* End XCBuildConfiguration section */
|
||||||
|
|
||||||
/* Begin XCConfigurationList section */
|
/* Begin XCConfigurationList section */
|
||||||
|
761EDD5B3003F176006FC7FB /* Build configuration list for PBXNativeTarget "Interject! iMessage" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
761EDD5C3003F176006FC7FB /* Debug */,
|
||||||
|
761EDD5D3003F176006FC7FB /* Release */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
98D0A2A027471FF80084F7F9 /* Build configuration list for PBXProject "Interject!" */ = {
|
98D0A2A027471FF80084F7F9 /* Build configuration list for PBXProject "Interject!" */ = {
|
||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
buildConfigurations = (
|
buildConfigurations = (
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"colors" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
//
|
||||||
|
// Intents.swift
|
||||||
|
// Interject!
|
||||||
|
//
|
||||||
|
|
||||||
|
import AppIntents
|
||||||
|
|
||||||
|
@available(iOS 16.0, *)
|
||||||
|
struct GenerateInsultIntent: AppIntent {
|
||||||
|
static var title: LocalizedStringResource = "Generate Insult"
|
||||||
|
static var description = IntentDescription("Generates a new random insult phrase.")
|
||||||
|
|
||||||
|
func perform() async throws -> some IntentResult & ReturnsValue<String> {
|
||||||
|
// Fall back to true (safe mode) if the app hasn't set the preference yet
|
||||||
|
let isSfw = UserDefaults.standard.object(forKey: "SFW") as? Bool ?? true
|
||||||
|
let sentence = Sentence().new(current: Sentence())
|
||||||
|
let insult = [
|
||||||
|
sentence.word(.first, safe: isSfw),
|
||||||
|
sentence.word(.second, safe: isSfw),
|
||||||
|
sentence.word(.noun, safe: isSfw)
|
||||||
|
].joined(separator: " ")
|
||||||
|
return .result(value: insult)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 16.0, *)
|
||||||
|
struct InterjectShortcuts: AppShortcutsProvider {
|
||||||
|
static var appShortcuts: [AppShortcut] {
|
||||||
|
AppShortcut(
|
||||||
|
intent: GenerateInsultIntent(),
|
||||||
|
phrases: [
|
||||||
|
"Generate an insult with \(.applicationName)",
|
||||||
|
"Insult me with \(.applicationName)",
|
||||||
|
"Give me an insult from \(.applicationName)"
|
||||||
|
],
|
||||||
|
shortTitle: "Generate Insult",
|
||||||
|
systemImageName: "bubble.left.fill"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -71,6 +71,65 @@ enum Appearance: Int, CaseIterable, Identifiable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Settings: ObservableObject {
|
||||||
|
@Published var phrases: [Sentence]
|
||||||
|
@Published var sfw: Bool
|
||||||
|
@Published var locked: Locked
|
||||||
|
@Published var font: Fonts
|
||||||
|
@Published var colorScheme: Appearance
|
||||||
|
|
||||||
|
init(phrases: [Sentence], sfw: Bool, locked: Locked, font: Fonts, colorScheme: Appearance) {
|
||||||
|
self.phrases = phrases
|
||||||
|
self.sfw = sfw
|
||||||
|
self.locked = locked
|
||||||
|
self.font = font
|
||||||
|
self.colorScheme = colorScheme
|
||||||
|
}
|
||||||
|
|
||||||
|
func add() {
|
||||||
|
let maxPhrase = 100
|
||||||
|
let newPhrase = new(current: self.phrases.first!)
|
||||||
|
if self.locked.adjective1 { newPhrase.adjective1 = self.phrases.first!.adjective1 }
|
||||||
|
if self.locked.adjective2 { newPhrase.adjective2 = self.phrases.first!.adjective2 }
|
||||||
|
if self.locked.noun { newPhrase.noun = self.phrases.first!.noun }
|
||||||
|
self.phrases.insert(newPhrase, at: 0)
|
||||||
|
if self.phrases.count > maxPhrase {
|
||||||
|
self.phrases.remove(at: self.phrases.count-1)
|
||||||
|
}
|
||||||
|
save()
|
||||||
|
}
|
||||||
|
|
||||||
|
func remove() {
|
||||||
|
if self.phrases.count > 1 {
|
||||||
|
if self.locked.adjective1 { self.phrases[1].adjective1 = self.phrases[0].adjective1 }
|
||||||
|
if self.locked.adjective2 { self.phrases[1].adjective2 = self.phrases[0].adjective2 }
|
||||||
|
if self.locked.noun { self.phrases[1].noun = self.phrases[0].noun }
|
||||||
|
self.phrases.remove(at: 0)
|
||||||
|
}
|
||||||
|
save()
|
||||||
|
}
|
||||||
|
|
||||||
|
func new(current: Sentence) -> Sentence {
|
||||||
|
let firstList = Sentence.first + Sentence.adjectives
|
||||||
|
let adj1List = firstList.filter({$0.word(true)
|
||||||
|
!= current.adjective1.word(true)}).filter({$0.word(true)
|
||||||
|
!= current.adjective2.word(true)})
|
||||||
|
let firstAdj = adj1List[Int.random(in: 0...adj1List.count-1)]
|
||||||
|
|
||||||
|
let adj2List = Sentence.adjectives.filter({$0.word(true)
|
||||||
|
!= current.adjective1.word(true)}).filter({$0.word(true)
|
||||||
|
!= current.adjective2.word(true)}).filter({$0.word(true)
|
||||||
|
!= firstAdj.word(true)})
|
||||||
|
let adjective2 = adj2List[Int.random(in: 0...adj2List.count-1)]
|
||||||
|
|
||||||
|
let nounList = Sentence.nouns.filter({$0.word(true)
|
||||||
|
!= current.noun.word(true)})
|
||||||
|
let noun = nounList[Int.random(in: 0...nounList.count-1)]
|
||||||
|
|
||||||
|
return Sentence(adjective1: firstAdj, adjective2: adjective2, noun: noun)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extension Settings {
|
extension Settings {
|
||||||
|
|
||||||
convenience init() {
|
convenience init() {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Copyright © 2018 Rory Hinnen. All rights reserved.
|
// Copyright © 2018 Rory Hinnen. All rights reserved.
|
||||||
//
|
//
|
||||||
import Foundation
|
import Foundation
|
||||||
import SwiftUI
|
import Combine
|
||||||
|
|
||||||
// MARK: enum
|
// MARK: enum
|
||||||
enum Place {
|
enum Place {
|
||||||
@@ -52,99 +52,6 @@ struct Locked {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* func newSentence(current: Sentence) -> Sentence {
|
|
||||||
// find adjective one, which could be from the pool of first words or adjectives.
|
|
||||||
// remove the current words from the list of possible words
|
|
||||||
// pick from the list for just one word.
|
|
||||||
let firstList = Sentence.first + Sentence.adjectives
|
|
||||||
let adj1List = firstList.filter({$0.word(true) != current.adjective1.word(true)}).filter({$0.word(true) != current.adjective2.word(true)})
|
|
||||||
let firstAdj = adj1List[Int.random(in: 0...adj1List.count-1)]
|
|
||||||
|
|
||||||
// find adjective two, only from the pool of adjectives
|
|
||||||
// remove current words and adjective one from the pool
|
|
||||||
// pick from the list for just one word
|
|
||||||
let adj2List = Sentence.adjectives.filter({$0.word(true) != current.adjective1.word(true)}).filter({$0.word(true) != current.adjective2.word(true)}).filter({$0.word(true) != firstAdj.word(true)})
|
|
||||||
let adjective2 = adj2List[Int.random(in: 0...adj2List.count-1)]
|
|
||||||
|
|
||||||
// find the noun, only from the pool of nouns
|
|
||||||
// remove the current word from the pool
|
|
||||||
// select the new noun.
|
|
||||||
let nounList = Sentence.nouns.filter({$0.word(true) != current.noun.word(true)})
|
|
||||||
let noun = nounList[Int.random(in: 0...nounList.count-1)]
|
|
||||||
|
|
||||||
// make a new sentence
|
|
||||||
return(Sentence(adjective1: firstAdj, adjective2: adjective2, noun: noun))
|
|
||||||
} */
|
|
||||||
|
|
||||||
class Settings: ObservableObject {
|
|
||||||
@Published var phrases: [Sentence]
|
|
||||||
@Published var sfw: Bool
|
|
||||||
@Published var locked: Locked
|
|
||||||
@Published var font: Fonts
|
|
||||||
@Published var colorScheme: Appearance
|
|
||||||
|
|
||||||
init(phrases: [Sentence], sfw: Bool, locked: Locked, font: Fonts, colorScheme: Appearance) {
|
|
||||||
self.phrases = phrases
|
|
||||||
self.sfw = sfw
|
|
||||||
self.locked = locked
|
|
||||||
self.font = font
|
|
||||||
self.colorScheme = colorScheme
|
|
||||||
}
|
|
||||||
|
|
||||||
func add() {
|
|
||||||
let maxPhrase = 100
|
|
||||||
let newPhrase = new(current: self.phrases.first!)
|
|
||||||
if self.locked.adjective1 { newPhrase.adjective1 = self.phrases.first!.adjective1 }
|
|
||||||
if self.locked.adjective2 { newPhrase.adjective2 = self.phrases.first!.adjective2}
|
|
||||||
if self.locked.noun { newPhrase.noun = self.phrases.first!.noun }
|
|
||||||
self.phrases.insert(newPhrase, at: 0)
|
|
||||||
if self.phrases.count > maxPhrase {
|
|
||||||
self.phrases.remove(at: self.phrases.count-1)
|
|
||||||
}
|
|
||||||
save()
|
|
||||||
}
|
|
||||||
|
|
||||||
func remove() {
|
|
||||||
if self.phrases.count > 1 {
|
|
||||||
if self.locked.adjective1 {self.phrases[1].adjective1 = self.phrases[0].adjective1}
|
|
||||||
if self.locked.adjective2 {self.phrases[1].adjective2 = self.phrases[0].adjective2}
|
|
||||||
if self.locked.noun {self.phrases[1].noun = self.phrases[0].noun}
|
|
||||||
self.phrases.remove(at: 0)
|
|
||||||
}
|
|
||||||
save()
|
|
||||||
}
|
|
||||||
|
|
||||||
func new(current: Sentence) -> Sentence {
|
|
||||||
// find adjective one, which could be from the pool of first words or adjectives.
|
|
||||||
// remove the current words from the list of possible words
|
|
||||||
// pick from the list for just one word.
|
|
||||||
let firstList = Sentence.first + Sentence.adjectives
|
|
||||||
let adj1List = firstList.filter({$0.word(true)
|
|
||||||
!= current.adjective1.word(true)}).filter({$0.word(true)
|
|
||||||
!= current.adjective2.word(true)})
|
|
||||||
let firstAdj = adj1List[Int.random(in: 0...adj1List.count-1)]
|
|
||||||
|
|
||||||
// find adjective two, only from the pool of adjectives
|
|
||||||
// remove current words and adjective one from the pool
|
|
||||||
// pick from the list for just one word
|
|
||||||
let adj2List = Sentence.adjectives.filter({$0.word(true)
|
|
||||||
!= current.adjective1.word(true)}).filter({$0.word(true)
|
|
||||||
!= current.adjective2.word(true)}).filter({$0.word(true)
|
|
||||||
!= firstAdj.word(true)})
|
|
||||||
let adjective2 = adj2List[Int.random(in: 0...adj2List.count-1)]
|
|
||||||
|
|
||||||
// find the noun, only from the pool of nouns
|
|
||||||
// remove the current word from the pool
|
|
||||||
// select the new noun.
|
|
||||||
let nounList = Sentence.nouns.filter({$0.word(true)
|
|
||||||
!= current.noun.word(true)})
|
|
||||||
let noun = nounList[Int.random(in: 0...nounList.count-1)]
|
|
||||||
|
|
||||||
// make a new sentence
|
|
||||||
return(Sentence(adjective1: firstAdj, adjective2: adjective2, noun: noun))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: Entry
|
// MARK: Entry
|
||||||
struct Entry: Codable {
|
struct Entry: Codable {
|
||||||
// The structure of the words themself.
|
// The structure of the words themself.
|
||||||
@@ -187,9 +94,9 @@ class Sentence: NSObject, Codable {
|
|||||||
// (like when I'm handing off to meaning)
|
// (like when I'm handing off to meaning)
|
||||||
// There are two initializers.
|
// There are two initializers.
|
||||||
|
|
||||||
fileprivate var adjective1: Entry
|
var adjective1: Entry
|
||||||
fileprivate var adjective2: Entry
|
var adjective2: Entry
|
||||||
fileprivate var noun: Entry
|
var noun: Entry
|
||||||
|
|
||||||
// This initializer will take three Entry vars and assign them into a sentence
|
// This initializer will take three Entry vars and assign them into a sentence
|
||||||
init(adjective1: Entry, adjective2: Entry, noun: Entry) {
|
init(adjective1: Entry, adjective2: Entry, noun: Entry) {
|
||||||
@@ -267,7 +174,7 @@ private struct WordList: Codable {
|
|||||||
extension Sentence {
|
extension Sentence {
|
||||||
// MARK: Create the pool of words
|
// MARK: Create the pool of words
|
||||||
private static let wordList: WordList = {
|
private static let wordList: WordList = {
|
||||||
guard let url = Bundle.main.url(forResource: "words", withExtension: "json"),
|
guard let url = Bundle(for: Sentence.self).url(forResource: "words", withExtension: "json"),
|
||||||
let data = try? Data(contentsOf: url),
|
let data = try? Data(contentsOf: url),
|
||||||
let list = try? JSONDecoder().decode(WordList.self, from: data) else {
|
let list = try? JSONDecoder().decode(WordList.self, from: data) else {
|
||||||
fatalError("words.json missing or malformed in bundle")
|
fatalError("words.json missing or malformed in bundle")
|
||||||
|
|||||||